:root {
    --bg: #ffffff;
    --sidebar: #f9f9f9;
    --sidebar-hover: #ececec;
    --text: #171717;
    --muted: #6b6b6b;
    --faint: #8f8f8f;
    --line: #e8e8e8;
    --line-dark: #d9d9d9;
    --black: #111111;
    --sidebar-width: 178px;
    font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    background: var(--bg);
    color: var(--text);
}

button,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
}

.app-shell.is-guest {
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
}

.guest-rail {
    display: none;
}

.app-shell.is-guest .mobile-scrim {
    display: none;
}

.app-shell.is-guest .guest-rail {
    position: fixed;
    z-index: 10;
    left: 0;
    top: 0;
    bottom: 0;
    width: 52px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 6px;
    background: #f9f9f9;
    border-right: 1px solid #ececec;
}

.app-shell.is-guest .sidebar {
    display: flex;
}

.rail-logo,
.rail-icon {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 10px;
    display: inline-grid;
    place-items: center;
    background: transparent;
    color: #0d0d0d;
}

.rail-logo:hover,
.rail-icon:hover {
    background: #ececec;
}

.rail-logo {
    font-size: 13px;
    font-weight: 700;
}

.rail-icon {
    position: relative;
    margin-top: 16px;
}

.rail-icon::before,
.rail-icon::after {
    content: "";
    position: absolute;
    display: block;
}

.rail-compose::before {
    width: 15px;
    height: 15px;
    border: 2px solid currentColor;
    border-radius: 5px;
}

.rail-compose::after {
    width: 8px;
    border-top: 2px solid currentColor;
    transform: rotate(-35deg);
    right: 9px;
    top: 11px;
}

.rail-search::before {
    width: 13px;
    height: 13px;
    border: 2px solid currentColor;
    border-radius: 50%;
}

.rail-search::after {
    width: 7px;
    border-top: 2px solid currentColor;
    transform: rotate(45deg);
    right: 9px;
    bottom: 9px;
}

.rail-image::before {
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-radius: 5px;
}

.rail-image::after {
    width: 9px;
    border-top: 2px solid currentColor;
    transform: rotate(-35deg);
    left: 11px;
    bottom: 12px;
}

.rail-help {
    margin-top: auto;
}

.rail-help::before {
    content: "?";
    font-size: 15px;
    line-height: 1;
}

.sidebar {
    height: 100vh;
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    padding: 8px 4px;
    background: var(--sidebar);
    overflow: hidden;
}

.history-scroll {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
}

.sidebar-top,
.topbar,
.composer-actions,
.account-area,
.left-tools,
.right-tools {
    display: flex;
    align-items: center;
}

.sidebar-top {
    justify-content: space-between;
    height: 40px;
    margin-bottom: 8px;
    padding: 0 4px;
}

.sidebar-title {
    color: #0d0d0d;
    text-decoration: none;
    font-size: 15px;
    font-weight: 600;
}

.side-icon,
.top-icon,
.round-tool,
.send-button,
.collapse-icon {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 999px;
    display: inline-grid;
    place-items: center;
    background: transparent;
    color: var(--text);
}

.collapse-icon::before {
    content: "";
    width: 15px;
    height: 12px;
    display: block;
    border: 1.8px solid currentColor;
    border-radius: 3px;
    box-shadow: inset -5px 0 0 rgba(0,0,0,.08);
}

.side-icon:hover,
.top-icon:hover,
.round-tool:hover,
.model-pill:hover,
.login-button:hover {
    background: var(--sidebar-hover);
}

.side-icon span,
.top-icon span {
    width: 17px;
    height: 13px;
    display: block;
    border-top: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    position: relative;
}

.side-icon span::before,
.top-icon span::before {
    content: "";
    position: absolute;
    left: 0;
    top: 4px;
    width: 17px;
    border-top: 2px solid currentColor;
}

.new-chat,
.side-menu button,
.history-block button {
    width: 100%;
    min-height: 36px;
    border: 0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    color: var(--text);
    background: transparent;
    text-align: left;
}

.new-chat:hover,
.new-chat,
.side-menu button:hover,
.history-block button:hover {
    background: var(--sidebar-hover);
}

.mini-logo {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    background: var(--black);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
}

.new-chat-icon {
    margin-left: auto;
    color: var(--faint);
    font-size: 13px;
}

.side-menu {
    padding-top: 8px;
    padding-bottom: 14px;
}

.menu-icon {
    width: 18px;
    height: 18px;
    display: inline-block;
    flex: 0 0 auto;
    position: relative;
}

.search-icon {
    border: 2px solid currentColor;
    border-radius: 50%;
    transform: scale(.72);
}

.search-icon::after {
    content: "";
    position: absolute;
    width: 8px;
    border-top: 2px solid currentColor;
    right: -6px;
    bottom: -3px;
    transform: rotate(45deg);
}

.library-icon,
.image-icon {
    border: 2px solid currentColor;
    border-radius: 5px;
}

.library-icon::before,
.image-icon::before {
    content: "";
    position: absolute;
    left: 4px;
    right: 4px;
    top: 5px;
    border-top: 2px solid currentColor;
}

.image-icon::after {
    content: "";
    position: absolute;
    left: 4px;
    bottom: 4px;
    width: 8px;
    border-top: 2px solid currentColor;
    transform: rotate(-35deg);
}

.more-icon::before {
    content: "...";
    top: -6px;
    left: 0;
    font-size: 18px;
    letter-spacing: 1px;
}

.history-block {
    padding-top: 10px;
}

.history-block h2 {
    margin: 0 0 4px;
    padding: 0 8px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.history-block button {
    min-height: 32px;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
}

.sidebar-bottom {
    margin-top: auto;
    padding-top: 14px;
    flex: 0 0 auto;
    position: relative;
}

.account-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
}

.account-card:hover {
    background: var(--sidebar-hover);
}

.account-info {
    flex: 1;
    min-width: 0;
}

.account-name {
    font-size: 14px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-badge {
    font-size: 12px;
    color: var(--muted);
}

.account-badge.is-vip {
    color: #e6a817;
    font-weight: 600;
}

.account-arrow {
    font-size: 18px;
    color: var(--muted);
}

.account-login {
    width: 100%;
    min-height: 40px;
    border: 0;
    border-radius: 8px;
    padding: 0 16px;
    background: var(--black);
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

.account-login:hover {
    opacity: 0.9;
}

.account-menu {
    position: absolute;
    bottom: 100%;
    left: 4px;
    right: 4px;
    margin-bottom: 8px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    padding: 6px;
    z-index: 100;
}

.account-menu button {
    width: 100%;
    min-height: 40px;
    border: 0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 12px;
    background: transparent;
    color: var(--text);
    font-size: 14px;
    text-align: left;
    cursor: pointer;
    transition: background 100ms ease;
}

.account-menu button:hover {
    background: var(--sidebar-hover);
}

.account-menu-logout {
    color: #d32f2f !important;
}

.menu-icon-inline {
    width: 18px;
    display: inline-block;
    text-align: center;
    flex: 0 0 auto;
}

.menu-divider {
    height: 1px;
    background: var(--line);
    margin: 4px 8px;
}

.account-menu-arrow {
    margin-left: auto;
    color: var(--faint);
    font-size: 16px;
}

/* ---- search panel ---- */
/* ---- search modal (ChatGPT style) ---- */
.search-modal {
    position: fixed;
    inset: 0;
    z-index: 500;
    display: grid;
    place-items: start center;
    padding-top: 12vh;
}

.search-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(2px);
}

.search-modal-box {
    position: relative;
    width: min(560px, calc(100vw - 32px));
    max-height: min(600px, calc(88vh - 12vh));
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.22);
    overflow: hidden;
    z-index: 1;
}

.search-modal-input-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
}

.search-modal-input {
    flex: 1;
    min-height: 28px;
    border: 0;
    outline: 0;
    padding: 0;
    background: transparent;
    color: var(--text);
    font-size: 16px;
}

.search-modal-input::placeholder {
    color: #9e9e9e;
}

.search-modal-close {
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    font-size: 22px;
    color: #9e9e9e;
    cursor: pointer;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.search-modal-close:hover {
    background: var(--sidebar-hover);
    color: var(--text);
}

.search-modal-results {
    flex: 1;
    overflow-y: auto;
    padding: 8px 12px 16px;
}

.search-new-chat {
    width: 100%;
    min-height: 44px;
    border: 0;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 12px;
    margin-bottom: 8px;
    background: #f7f7f7;
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
}

.search-new-chat:hover {
    background: #efefef;
}

.search-group {
    margin-bottom: 12px;
}

.search-group-title {
    padding: 8px 12px 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
}

.search-result-item {
    width: 100%;
    min-height: 42px;
    border: 0;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 12px;
    background: transparent;
    color: var(--text);
    font-size: 14px;
    text-align: left;
    cursor: pointer;
}

.search-result-item:hover {
    background: var(--sidebar-hover);
}

.search-item-icon {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    display: grid;
    place-items: center;
    color: var(--muted);
    font-size: 13px;
}

.search-result-item .search-item-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-empty {
    padding: 24px 12px;
    text-align: center;
    color: var(--faint);
    font-size: 13px;
}

.model-menu {
    position: absolute;
    bottom: 100%;
    right: 0;
    margin-bottom: 12px;
    background: #fff;
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 16px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.14);
    padding: 6px;
    display: flex;
    gap: 4px;
    z-index: 200;
}

.model-panel {
    min-width: 130px;
    max-height: 320px;
    overflow-y: auto;
}

.model-panel-sub {
    border-left: 1px solid var(--line);
    padding-left: 4px;
}

.model-section {
    padding: 2px 0;
}

.model-section + .model-section {
    border-top: 1px solid var(--line);
    margin-top: 4px;
    padding-top: 4px;
}

.model-section-title {
    padding: 6px 10px 4px;
    font-size: 11px;
    font-weight: 600;
    color: var(--faint);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.model-menu button {
    width: 100%;
    min-height: 34px;
    border: 0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 0 10px;
    background: transparent;
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
}

.model-menu button:hover {
    background: var(--sidebar-hover);
}

.model-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.model-check {
    color: #0d0d0d;
    font-size: 13px;
    flex: 0 0 auto;
}

.model-sub-trigger {
    width: 100%;
    min-height: 34px;
    border: 0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
    background: transparent;
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
}

.model-sub-trigger:hover {
    background: var(--sidebar-hover);
}

.model-arrow {
    font-size: 16px;
    color: var(--faint);
    line-height: 1;
}

.model-sub-head {
    display: flex;
    align-items: center;
    padding: 6px 10px 4px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 2px;
}

.model-sub-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--faint);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.model-panel-sub .model-section-title,
.model-sub-title {
    padding-left: 10px;
}

.composer-model {
    min-height: 34px;
    border: 1px solid var(--line-dark);
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0 12px;
    background: #fff;
    color: #4a4a4a;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    flex: 0 0 auto;
    transition: background 120ms ease;
}

.composer-model:hover {
    background: #f7f7f7;
    color: var(--text);
}

.composer-model .chevron {
    font-size: 12px;
    color: var(--faint);
}

.sidebar-collapsed .sidebar {
    width: 52px;
}

.sidebar-collapsed .sidebar-title,
.sidebar-collapsed .new-chat span:not(.mini-logo),
.sidebar-collapsed .side-menu span:not(.menu-icon),
.sidebar-collapsed .history-scroll,
.sidebar-collapsed .account-info,
.sidebar-collapsed .account-arrow {
    display: none;
}

.sidebar-collapsed .new-chat {
    justify-content: center;
    padding: 8px;
}

.sidebar-collapsed .side-menu button {
    justify-content: center;
    padding: 8px;
}

.workspace {
    min-width: 0;
    min-height: 100vh;
    display: grid;
    grid-template-rows: 56px minmax(0, 1fr);
    background: #fff;
}

.activity-panel {
    position: fixed;
    z-index: 900;
    right: 0;
    top: 0;
    bottom: 0;
    width: min(392px, 32vw);
    border-left: 1px solid #e5e5e5;
    display: flex;
    flex-direction: column;
    background: #f7f7f7;
    box-shadow: -10px 0 30px rgba(0, 0, 0, .04);
}

.activity-head {
    min-height: 52px;
    border-bottom: 1px solid #e6e6e6;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px 0 18px;
    background: #fff;
}

.activity-head strong {
    color: #111;
    font-size: 16px;
    font-weight: 600;
}

.activity-head span {
    margin-left: 8px;
    color: #767676;
    font-size: 14px;
}

.activity-close {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 8px;
    display: grid;
    place-items: center;
    background: transparent;
    color: #333;
    font-size: 24px;
    line-height: 1;
}

.activity-close:hover {
    background: #ededed;
}

.activity-body {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 14px;
}

.activity-code-block {
    border: 1px solid #e6e6e6;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
}

.activity-code-block + .activity-code-block {
    margin-top: 14px;
}

.activity-code-title {
    min-height: 38px;
    border-bottom: 1px solid #eeeeee;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 0 10px 0 12px;
    background: #fafafa;
}

.activity-code-title span {
    color: #111;
    font-size: 13px;
    font-weight: 600;
}

.activity-code-block pre {
    margin: 0;
    overflow: auto;
    padding: 14px;
    background: #fff;
}

.activity-code-block code {
    color: #111;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13px;
    line-height: 1.7;
    white-space: pre;
}

@media (min-width: 1180px) {
    .app-shell.has-activity-panel .workspace {
        margin-right: min(392px, 32vw);
    }

    .app-shell.has-activity-panel .message-list {
        width: min(760px, calc(100% - 56px));
    }
}

@media (max-width: 1179px) {
    .activity-panel {
        display: none !important;
    }
}

.app-shell.is-guest .workspace {
    margin-left: 0;
}

.topbar {
    height: 56px;
    padding: 8px 14px;
    justify-content: space-between;
    position: relative;
}

.top-icon {
    display: none;
}

.app-shell.is-guest .top-icon {
    display: inline-grid;
}

.app-shell.is-guest .topbar {
    justify-content: flex-start;
    gap: 0;
    padding: 8px 23px 8px 8px;
}

.brand-title {
    font-size: 18px;
    font-weight: 600;
    color: #111;
    padding: 0 4px;
}

.chevron {
    color: var(--muted);
    font-size: 16px;
}

.account-area {
    gap: 8px;
    flex: 0 0 auto;
}

.login-button,
.signup-button {
    min-height: 36px;
    border: 0;
    border-radius: 999px;
    padding: 0 14px;
    font-size: 14px;
    white-space: nowrap;
    flex: 0 0 auto;
}

.login-button {
    background: var(--black);
    color: #fff;
}

.signup-button {
    border: 1px solid var(--line-dark);
    background: #fff;
    color: var(--text);
}

.signup-button:hover {
    background: #f7f7f7;
}

.user-chip {
    min-height: 36px;
    border: 0;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px 4px 4px;
    background: #f1f1f1;
    color: var(--text);
    white-space: nowrap;
    flex: 0 0 auto;
    max-width: 160px;
}

.user-chip span {
    overflow: hidden;
    text-overflow: ellipsis;
}

.avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-grid;
    place-items: center;
    background: var(--black);
    color: #fff;
    font-size: 12px;
    overflow: hidden;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-stage {
    min-height: 0;
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    justify-items: center;
    overflow: hidden;
    padding: 0 18px 14px;
}

.app-shell.is-guest .chat-stage {
    padding-left: 0;
    padding-right: 0;
}

.start-panel {
    width: min(768px, 100%);
    align-self: center;
    transform: translateY(-8vh);
}

.app-shell.is-guest .start-panel {
    width: min(100% - 26px, 768px);
    transform: translateY(-3vh);
}

.start-panel h1 {
    margin: 0 0 26px;
    text-align: center;
    color: #2f2f2f;
    font-size: 32px;
    line-height: 1.18;
    font-weight: 600;
    letter-spacing: 0;
}

.app-shell.is-guest .start-panel h1 {
    margin-bottom: 24px;
    font-size: 24px;
    font-weight: 500;
}

.composer {
    width: 100%;
    min-height: 118px;
    border: 1px solid var(--line-dark);
    border-radius: 28px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
    padding: 12px;
    position: relative;
    transition: border-color 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.composer:focus-within {
    border-color: #c0c0c0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, .1);
}

.composer.is-dragging {
    border-color: #111;
    background: #fbfbfb;
    box-shadow: inset 0 0 0 1px #111, 0 8px 28px rgba(0, 0, 0, .08);
}

.mode-tabs {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin: 0 0 8px 2px;
    padding: 2px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #f7f7f7;
}

.mode-tab {
    min-height: 28px;
    border: 0;
    border-radius: 999px;
    padding: 0 12px;
    background: transparent;
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
}

.mode-tab.active {
    background: #111;
    color: #fff;
}

.image-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: -2px 0 10px;
    padding: 0 2px;
}

.image-options label {
    min-height: 34px;
    border: 1px solid var(--line);
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 0 10px 0 12px;
    background: #fff;
    color: var(--muted);
    font-size: 13px;
}

.image-options select {
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text);
    font: inherit;
}

.image-reference {
    width: fit-content;
    max-width: min(360px, 100%);
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr) 28px;
    align-items: center;
    gap: 9px;
    margin: -2px 0 10px 2px;
    padding: 6px 7px 6px 6px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
}

.image-reference img {
    width: 52px;
    height: 52px;
    border-radius: 10px;
    object-fit: cover;
    background: #eee;
}

.image-reference strong,
.image-reference span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.image-reference strong {
    font-size: 13px;
    font-weight: 600;
}

.image-reference span {
    color: var(--muted);
    font-size: 12px;
}

.image-reference button {
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    font-size: 20px;
}

.image-reference button:hover {
    background: var(--sidebar-hover);
    color: var(--text);
}

.attachment-menu {
    position: absolute;
    left: 0;
    bottom: calc(100% + 10px);
    z-index: 220;
    min-width: 210px;
    padding: 7px;
    border: 1px solid rgba(0, 0, 0, .08);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 14px 38px rgba(0, 0, 0, .16);
}

.attachment-menu button {
    width: 100%;
    min-height: 42px;
    border: 0;
    border-radius: 11px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 10px;
    background: transparent;
    color: var(--text);
    font-size: 14px;
    text-align: left;
}

.attachment-menu button:hover {
    background: #f5f5f5;
}

.attach-icon {
    width: 22px;
    height: 22px;
    border: 1.8px solid currentColor;
    border-radius: 6px;
    display: inline-block;
    position: relative;
    flex: 0 0 auto;
}

.attach-icon.image-icon::after {
    content: "";
    position: absolute;
    left: 5px;
    right: 5px;
    bottom: 6px;
    border-top: 2px solid currentColor;
    transform: rotate(-35deg);
}

.attach-icon.file-icon {
    border-radius: 5px;
}

.attach-icon.file-icon::after {
    content: "";
    position: absolute;
    left: 5px;
    right: 5px;
    top: 7px;
    border-top: 1.8px solid currentColor;
    box-shadow: 0 5px 0 currentColor;
}

.attach-icon.chat-icon {
    border-radius: 999px;
}

.attach-icon.chat-icon::after {
    content: "";
    position: absolute;
    right: 1px;
    bottom: -3px;
    width: 6px;
    height: 6px;
    border-left: 1.8px solid currentColor;
    border-bottom: 1.8px solid currentColor;
    background: #fff;
    transform: rotate(-20deg);
}

.composer-toast {
    position: absolute;
    left: 14px;
    bottom: calc(100% + 10px);
    z-index: 230;
    max-width: min(360px, calc(100vw - 32px));
    border: 1px solid rgba(0, 0, 0, .08);
    border-radius: 12px;
    padding: 9px 12px;
    background: #111;
    color: #fff;
    font-size: 13px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, .18);
}

.app-shell.is-guest .start-panel .composer {
    height: 86px;
    min-height: 86px;
    border-radius: 25px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, .08);
    padding: 10px 12px 8px;
}

.composer textarea {
    width: 100%;
    min-height: 46px;
    max-height: 180px;
    border: 0;
    outline: 0;
    resize: none;
    padding: 4px 6px 9px;
    background: transparent;
    color: var(--text);
    line-height: 1.55;
    font-size: 16px;
}

.app-shell.is-guest .composer textarea {
    min-height: 26px;
    padding: 2px 0 4px;
}

.app-shell.is-guest .mode-tabs,
.app-shell.is-guest .image-options,
.app-shell.is-guest .image-reference {
    display: none;
}

.composer textarea::placeholder {
    color: #8b8b8b;
}

.composer-actions {
    justify-content: space-between;
}

.left-tools,
.right-tools {
    gap: 8px;
}

.round-tool {
    border: 1px solid var(--line-dark);
    font-size: 20px;
    line-height: 1;
}

.pill-tool {
    min-height: 36px;
    border: 1px solid var(--line-dark);
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 0 13px;
    background: #fff;
    color: #333;
}

.pill-tool:hover {
    background: #f7f7f7;
}

.tool-dot {
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-radius: 4px;
    display: inline-block;
}

.send-button {
    background: var(--black);
    color: #fff;
    font-size: 20px;
}

.send-button:disabled {
    cursor: default;
    opacity: .35;
}

.suggestions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 24px;
}

.app-shell.is-guest .suggestions {
    display: none;
}

.suggestions button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0 18px;
    background: #fff;
    color: #3a3a3a;
    font-size: 14px;
    font-weight: 400;
    transition: background 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.suggestions button:hover {
    background: #f7f7f7;
    border-color: #d0d0d0;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

/* suggestion icons */
.sug-icon {
    width: 18px;
    height: 18px;
    display: inline-block;
    flex: 0 0 auto;
    position: relative;
}

.sug-icon.camera-icon {
    border: 1.8px solid currentColor;
    border-radius: 5px;
}
.sug-icon.camera-icon::after {
    content: "";
    position: absolute;
    left: 4px;
    bottom: 4px;
    width: 7px;
    border-top: 1.8px solid currentColor;
    transform: rotate(-35deg);
}

.sug-icon.pencil-icon::before {
    content: "";
    position: absolute;
    left: 2px;
    top: 1px;
    width: 12px;
    height: 12px;
    border: 1.8px solid currentColor;
    border-radius: 2px;
    transform: rotate(-45deg);
}
.sug-icon.pencil-icon::after {
    content: "";
    position: absolute;
    left: 1px;
    bottom: 0;
    width: 6px;
    height: 1.8px;
    background: currentColor;
    transform: rotate(-45deg);
    transform-origin: left;
}

.sug-icon.globe-icon {
    border: 1.8px solid currentColor;
    border-radius: 50%;
}
.sug-icon.globe-icon::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 0;
    border-left: 1.8px solid currentColor;
    transform: translateX(-50%);
}
.sug-icon.globe-icon::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 0;
    border-top: 1.8px solid currentColor;
    transform: translateY(-50%);
}

.message-list {
    width: min(760px, 100%);
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 24px 0 24px;
}

.message {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
}

.message.user {
    grid-template-columns: minmax(0, 1fr) 32px;
}

.message.user .avatar {
    order: 2;
    align-self: end;
}

.bubble {
    max-width: 100%;
    line-height: 1.72;
    font-size: 16px;
    color: var(--text);
    white-space: pre-wrap;
    word-break: break-word;
}

.message.assistant .bubble {
    white-space: normal;
}

.message.assistant .bubble p,
.message.assistant .bubble ul,
.message.assistant .bubble ol,
.message.assistant .bubble pre {
    margin: 0 0 14px;
}

.message.assistant .bubble > :last-child {
    margin-bottom: 0;
}

.message.assistant .bubble h2,
.message.assistant .bubble h3,
.message.assistant .bubble h4 {
    margin: 18px 0 8px;
    color: #111;
    font-size: 17px;
    line-height: 1.45;
    font-weight: 650;
    letter-spacing: 0;
}

.message.assistant .bubble h2:first-child,
.message.assistant .bubble h3:first-child,
.message.assistant .bubble h4:first-child {
    margin-top: 0;
}

.message.assistant .bubble ul,
.message.assistant .bubble ol {
    padding-left: 22px;
}

.message.assistant .bubble li + li {
    margin-top: 4px;
}

.message.assistant .bubble hr {
    height: 1px;
    border: 0;
    margin: 18px 0;
    background: var(--line);
}

.message.assistant .bubble a {
    color: #0b57d0;
    text-decoration: none;
    overflow-wrap: anywhere;
}

.message.assistant .bubble a:hover {
    text-decoration: underline;
}

.message.assistant .bubble .file-link-unavailable {
    max-width: 100%;
    border: 1px solid #e2e2e2;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 4px 0;
    padding: 6px 9px;
    background: #fafafa;
    color: #555;
    vertical-align: middle;
}

.message.assistant .bubble .file-link-unavailable::before {
    content: "";
    width: 14px;
    height: 17px;
    border: 1.5px solid #b8b8b8;
    border-radius: 3px;
    background: linear-gradient(135deg, transparent 0 68%, #e9e9e9 69%);
    flex: 0 0 auto;
}

.message.assistant .bubble .file-link-unavailable small {
    border-radius: 999px;
    padding: 2px 7px;
    background: #eeeeee;
    color: #777;
    font-size: 12px;
    white-space: nowrap;
}

.message.assistant .bubble .file-link-unavailable .file-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.message.assistant .bubble .file-generate {
    border: 0;
    border-radius: 999px;
    padding: 3px 8px;
    background: #111;
    color: #fff;
    font-size: 12px;
    line-height: 1.4;
    white-space: nowrap;
    cursor: pointer;
}

.message.assistant .bubble .file-generate:disabled {
    cursor: default;
    opacity: .65;
}

.message.assistant .bubble .file-link-ready {
    max-width: 100%;
    border: 1px solid #d8eadc;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 4px 0;
    padding: 6px 9px;
    background: #f7fcf8;
    vertical-align: middle;
}

.message.assistant .bubble .file-link-ready::before {
    content: "";
    width: 14px;
    height: 17px;
    border: 1.5px solid #5f9e68;
    border-radius: 3px;
    background: linear-gradient(135deg, transparent 0 68%, #dff0e2 69%);
    flex: 0 0 auto;
}

.code-artifact-card {
    width: min(360px, 100%);
    border: 1px solid #e1e1e1;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 4px 0 14px;
    padding: 10px 12px;
    background: #fbfbfb;
    color: #111;
    text-align: left;
}

.code-artifact-card:hover {
    background: #f2f2f2;
}

.code-artifact-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    background: #111;
    color: #fff;
    flex: 0 0 auto;
}

.code-artifact-icon::before {
    content: "</>";
    font-size: 11px;
    font-weight: 700;
}

.code-artifact-card strong,
.code-artifact-card small {
    display: block;
}

.code-artifact-card strong {
    font-size: 14px;
    line-height: 18px;
}

.code-artifact-card small {
    color: #777;
    font-size: 12px;
    line-height: 16px;
}

.message.assistant .bubble code {
    border-radius: 5px;
    padding: 2px 5px;
    background: #f4f4f4;
    color: #111;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.92em;
}

.message.assistant .bubble pre {
    position: relative;
    overflow-x: auto;
    border-radius: 10px;
    padding: 42px 14px 12px;
    background: #f6f6f6;
}

.message.assistant .bubble .code-copy,
.activity-panel .code-copy {
    position: absolute;
    right: 8px;
    top: 8px;
    min-height: 26px;
    border: 1px solid #dedede;
    border-radius: 7px;
    padding: 0 9px;
    background: #fff;
    color: #555;
    font-size: 12px;
    line-height: 24px;
    cursor: pointer;
}

.activity-panel .code-copy {
    position: static;
    flex: 0 0 auto;
}

.message.assistant .bubble .code-copy:hover,
.message.assistant .bubble .code-copy.copied,
.activity-panel .code-copy:hover,
.activity-panel .code-copy.copied {
    border-color: #cfcfcf;
    background: #eeeeee;
    color: #111;
}

.message.assistant .bubble pre code {
    display: block;
    padding: 0;
    background: transparent;
    white-space: pre;
}

.message-text + .chat-attachment-thumb,
.chat-attachment-thumb + .message-text {
    margin-top: 8px;
}

.chat-attachment-thumb {
    width: min(220px, 100%);
    border: 0;
    border-radius: 14px;
    display: block;
    overflow: hidden;
    padding: 0;
    background: #f0f0f0;
}

.chat-attachment-thumb img {
    display: block;
    width: 100%;
    max-height: 180px;
    object-fit: cover;
}

.message.user .bubble {
    justify-self: end;
    max-width: min(600px, 100%);
    padding: 10px 16px;
    border-radius: 20px;
    background: #f4f4f4;
}

.bubble.typing {
    color: var(--muted);
}

.bubble.error {
    color: #c0362c;
}

.bubble .gen-image {
    display: block;
    max-width: 100%;
    width: 100%;
    border-radius: 14px;
    background: #f4f4f4;
    cursor: zoom-in;
}

/* 生图卡片 ChatGPT 式布局 */
.image-bubble .img-caption {
    color: var(--muted);
    font-size: 14px;
    margin-bottom: 4px;
    line-height: 1.5;
}

.image-bubble .img-meta {
    color: var(--faint);
    font-size: 12px;
    margin-bottom: 10px;
}

.img-grid {
    display: grid;
    grid-template-columns: minmax(0, 360px);
    gap: 10px;
}

.img-grid.multi {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: 520px;
}

.img-card {
    position: relative;
    border-radius: 14px;
    overflow: hidden;
    background: #f4f4f4;
}

.img-card.loading {
    min-height: 220px;
}

.img-card.loading::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(100deg, #ececec 30%, #f6f6f6 50%, #ececec 70%);
    background-size: 200% 100%;
    animation: img-shimmer 1.3s ease-in-out infinite;
}

.img-skeleton {
    width: 100%;
    max-width: 360px;
    height: 240px;
    border-radius: 14px;
    background: linear-gradient(100deg, #ececec 30%, #f6f6f6 50%, #ececec 70%);
    background-size: 200% 100%;
    animation: img-shimmer 1.3s ease-in-out infinite;
}

@keyframes img-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.img-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 6px;
    opacity: 0;
    transition: opacity 120ms ease;
}

.img-download,
.img-reuse {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 999px;
    display: grid;
    place-items: center;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 16px;
    text-decoration: none;
}

.img-card:hover .img-actions {
    opacity: 1;
}

.img-download:hover,
.img-reuse:hover {
    background: rgba(0, 0, 0, 0.75);
}

/* 灯箱 */
.img-lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    background: rgba(0, 0, 0, 0.82);
    cursor: zoom-out;
}

.img-lightbox img {
    max-width: 92vw;
    max-height: 92vh;
    border-radius: 10px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
    position: fixed;
    top: 20px;
    right: 24px;
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.28);
}

.dock-composer {
    width: min(768px, 100%);
    padding-bottom: 2px;
}

.dock-composer .composer {
    min-height: 96px;
}

.dock-composer .composer textarea {
    min-height: 32px;
}

.notice {
    margin: 8px 0 0;
    text-align: center;
    color: var(--muted);
    font-size: 12px;
}

.app-shell.is-guest .chat-stage::after {
    content: "WlChat 是 AI。使用即表示你同意我们的条款和隐私政策。聊天内容可能会被审核，并用于改进我们的 AI 模型。了解更多";
    position: fixed;
    left: 68px;
    right: 16px;
    bottom: 10px;
    color: var(--muted);
    text-align: center;
    font-size: 12px;
}

@media (min-width: 821px) {
    .app-shell.is-guest .guest-rail {
        display: none;
    }

    .app-shell.is-guest .workspace {
        grid-template-rows: 56px minmax(0, 1fr);
    }

    .app-shell.is-guest .topbar {
        visibility: hidden;
    }

    .app-shell.is-guest .top-icon {
        display: none;
    }

    .app-shell.is-guest .topbar {
        padding-left: 23px;
    }

    .app-shell.is-guest .signup-button {
        padding-left: 12px;
        padding-right: 12px;
    }

    .app-shell.is-guest .start-panel {
        width: 770px;
        transform: translate(-64px, -10.7vh);
    }

    .app-shell.is-guest .start-panel h1 {
        margin-bottom: 20px;
        font-size: 24px;
        line-height: 42px;
        font-weight: 400;
    }

    .app-shell.is-guest .start-panel .composer {
        height: 56px;
        min-height: 56px;
        border-radius: 999px;
        padding: 9px 10px 9px 14px;
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .app-shell.is-guest .composer textarea {
        order: 2;
        min-height: 34px;
        height: 34px !important;
        flex: 1 1 auto;
        padding: 7px 0 0;
        overflow: hidden;
    }

    .app-shell.is-guest .composer-actions {
        display: contents;
    }

    .app-shell.is-guest .left-tools,
    .app-shell.is-guest .right-tools {
        gap: 8px;
    }

    .app-shell.is-guest .left-tools {
        order: 1;
    }

    .app-shell.is-guest .right-tools {
        order: 3;
    }

    .app-shell.is-guest .pill-tool {
        display: none;
    }

    .app-shell.is-guest .round-tool {
        border: 0;
    }

    .app-shell.is-guest .right-tools .round-tool {
        font-size: 18px;
    }

    .app-shell.is-guest .send-button {
        width: 36px;
        padding: 0;
        background: #0d0d0d;
        color: #fff;
        font-size: 20px;
    }

    .app-shell.is-guest .send-button::after {
        content: none;
    }

    .app-shell.is-guest .suggestions {
        display: flex;
    }
}

.mobile-only,
.mobile-scrim {
    display: none;
}

@media (max-width: 820px) {
    .app-shell {
        display: block;
    }

    .app-shell.is-guest .guest-rail {
        display: none;
    }

    .app-shell.is-guest .workspace {
        margin-left: 0;
    }

    .sidebar {
        position: fixed;
        z-index: 30;
        left: 0;
        top: 0;
        width: var(--sidebar-width);
        transform: translateX(-100%);
        transition: transform 180ms ease;
    }

    .app-shell[data-sidebar-open="true"] .sidebar {
        transform: translateX(0);
    }

    .mobile-scrim {
        position: fixed;
        inset: 0;
        z-index: 20;
        background: rgba(0, 0, 0, .32);
    }

    .app-shell[data-sidebar-open="true"] .mobile-scrim,
    .mobile-only {
        display: block;
    }

    .top-icon {
        display: inline-grid;
    }

    .topbar {
        padding: 8px 10px;
    }

    .model-pill {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        font-size: 17px;
    }

    .app-shell.is-guest .model-pill {
        position: static;
        transform: none;
        left: auto;
        font-size: 18px;
    }

    .login-button {
        display: none;
    }

    .app-shell.is-guest .login-button {
        display: inline-block;
    }

    .app-shell.is-guest .chat-stage::after {
        left: 16px;
    }

    .signup-button {
        min-height: 34px;
        padding: 0 12px;
    }

    .chat-stage {
        padding: 0 10px 10px;
    }

    .start-panel {
        transform: translateY(-5vh);
    }

    .start-panel h1 {
        margin-bottom: 22px;
        font-size: 28px;
    }

    .composer {
        min-height: 110px;
        border-radius: 26px;
    }

    .suggestions {
        gap: 7px;
    }

    .suggestions button {
        min-height: 34px;
        padding: 0 12px;
    }
}

/* GPT-like composer refresh */
.chat-stage {
    grid-template-rows: minmax(0, 1fr) auto;
}

.start-panel {
    width: min(768px, calc(100vw - 32px));
    transform: translateY(-4vh);
}

.start-panel h1 {
    margin-bottom: 28px;
    color: #0d0d0d;
    font-size: 28px;
    font-weight: 600;
    letter-spacing: -0.3px;
}

.gpt-composer {
    min-height: 56px;
    border-radius: 28px;
    padding: 10px 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, .08);
    transition: box-shadow 150ms ease, border-color 150ms ease;
}

.app-shell[data-chat-mode="chat"] .start-panel .gpt-composer:not(:focus-within) {
    border-color: #e1e1e1;
}

.gpt-composer textarea {
    min-height: 32px;
    padding: 6px 6px 8px;
    font-size: 15px;
}

.gpt-composer .composer-actions {
    min-height: 36px;
}

.left-tools,
.right-tools {
    position: relative;
}

.voice-button {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    position: relative;
}

.voice-button::before {
    content: "";
    width: 10px;
    height: 16px;
    border: 2px solid #111;
    border-radius: 999px;
    position: absolute;
    left: 12px;
    top: 7px;
}

.voice-button::after {
    content: "";
    width: 16px;
    height: 9px;
    border-bottom: 2px solid #111;
    border-radius: 0 0 12px 12px;
    position: absolute;
    left: 9px;
    top: 18px;
}

.voice-button:hover {
    background: #f4f4f4;
}

.image-tool-chip,
.ratio-chip {
    min-height: 34px;
    border: 0;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 11px;
    background: #f5f5f5;
    color: #2563eb;
    font-size: 14px;
}

.ratio-chip {
    color: #171717;
}

.attachment-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 8px;
}

.attachment-chip {
    max-width: 270px;
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr) 28px;
    align-items: center;
    gap: 9px;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 6px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
}

.attachment-chip img {
    width: 52px;
    height: 52px;
    border-radius: 10px;
    object-fit: cover;
    background: #eee;
}

.file-chip-icon {
    width: 52px;
    height: 52px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: #f2f2f2;
}

.attachment-meta {
    min-width: 0;
}

.attachment-meta strong,
.attachment-meta span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.attachment-meta strong {
    font-size: 13px;
}

.attachment-meta span {
    color: var(--muted);
    font-size: 12px;
}

.attachment-chip button {
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    font-size: 20px;
}

.attachment-chip button:hover {
    background: #f1f1f1;
    color: #111;
}

.attachment-menu,
.ratio-menu {
    position: absolute;
    left: 0;
    bottom: calc(100% + 10px);
    z-index: 250;
    min-width: 210px;
    padding: 7px;
    border: 1px solid rgba(0, 0, 0, .08);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 14px 38px rgba(0, 0, 0, .16);
}

.attachment-menu button,
.ratio-menu button {
    width: 100%;
    min-height: 42px;
    border: 0;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 0 10px;
    background: transparent;
    color: var(--text);
    font-size: 14px;
    text-align: left;
}

.attachment-menu button:hover,
.ratio-menu button:hover {
    background: #f5f5f5;
}

.ratio-menu {
    min-width: 174px;
}

.ratio-title {
    padding: 8px 10px;
    color: var(--muted);
    font-size: 13px;
}

.gpt-model-menu {
    min-width: 160px;
    padding: 6px;
}

.gpt-model-menu .model-section-title {
    display: none;
}

.suggestions {
    margin-top: 24px;
}

.image-inspiration {
    width: 100%;
    margin-top: 26px;
}

.inspiration-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

.inspiration-head h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.inspiration-nav {
    display: flex;
    gap: 8px;
}

.inspiration-nav button {
    width: 36px;
    height: 36px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    font-size: 22px;
}

.inspiration-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.inspiration-upload,
.inspiration-card {
    aspect-ratio: 1 / 1;
    border: 0;
    border-radius: 18px;
    overflow: hidden;
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
    padding: 14px;
    color: #fff;
    background: linear-gradient(135deg, #f4f4f4, #e8e8e8);
    text-align: left;
    position: relative;
}

.inspiration-upload {
    align-items: center;
    justify-content: center;
    flex-direction: column;
    color: #555;
    background: #f7f7f7;
}

.inspiration-upload span {
    font-size: 30px;
    line-height: 1;
    margin-bottom: auto;
    margin-top: auto;
}

.inspiration-upload strong {
    margin-top: auto;
    font-size: 13px;
    font-weight: 500;
}

.inspiration-card:nth-child(2) {
    background: radial-gradient(circle at 50% 42%, #dadada, #111 72%);
}

.inspiration-card:nth-child(3) {
    background: linear-gradient(135deg, #d9d9d9, #6f6f6f);
}

.inspiration-card:nth-child(4) {
    background: linear-gradient(135deg, #f8f8f8, #1d4ed8 55%, #111);
}

.inspiration-card span {
    position: relative;
    z-index: 1;
    font-size: 13px;
    font-weight: 600;
    text-shadow: 0 1px 8px rgba(0, 0, 0, .5);
}

.app-shell[data-chat-mode="image"] .gpt-composer {
    min-height: 104px;
}

.app-shell[data-chat-mode="image"] .start-panel {
    transform: translateY(-2vh);
}

@media (max-width: 820px) {
    .inspiration-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .start-panel {
        width: min(100%, calc(100vw - 20px));
    }
}

/* Final ChatGPT-like UI restore */
:root {
    --sidebar-width: 254px;
}

@media (min-width: 821px) {
    .app-shell .workspace,
    .app-shell.is-guest .workspace {
        grid-template-rows: minmax(0, 1fr);
    }

    .app-shell .topbar,
    .app-shell.is-guest .topbar {
        display: none;
    }
}

.app-shell[data-chat-mode="chat"] .start-panel,
.app-shell.is-guest[data-chat-mode="chat"] .start-panel,
.app-shell[data-chat-mode="image"] .start-panel,
.app-shell.is-guest[data-chat-mode="image"] .start-panel {
    width: min(768px, calc(100vw - var(--sidebar-width) - 64px));
}

.app-shell[data-chat-mode="chat"] .start-panel {
    transform: translateY(-8.5vh);
}

.app-shell[data-chat-mode="image"] .start-panel,
.app-shell.is-guest[data-chat-mode="image"] .start-panel {
    transform: translateY(-4vh);
}

.start-panel h1,
.app-shell.is-guest .start-panel h1 {
    color: #111;
    font-size: 26px;
    line-height: 1.25;
    font-weight: 500;
    letter-spacing: 0;
}

.app-shell[data-chat-mode="chat"] .start-panel h1 {
    margin-bottom: 32px;
}

.app-shell[data-chat-mode="image"] .start-panel h1 {
    margin-bottom: 32px;
}

.app-shell[data-chat-mode="chat"] .start-panel .gpt-composer,
.app-shell.is-guest[data-chat-mode="chat"] .start-panel .gpt-composer {
    width: 100%;
    height: 56px;
    min-height: 56px;
    display: flex;
    align-items: center;
    padding: 0 114px 0 58px;
    border: 1px solid #e0e0e0;
    border-radius: 28px;
    background: #fff;
    box-shadow: 0 8px 26px rgba(0, 0, 0, .07);
}

.app-shell[data-chat-mode="image"] .start-panel .gpt-composer,
.app-shell.is-guest[data-chat-mode="image"] .start-panel .gpt-composer {
    width: 100%;
    height: 104px;
    min-height: 104px;
    display: block;
    padding: 16px 14px 12px;
    border: 1px solid #e1e1e1;
    border-radius: 28px;
    background: #fff;
    box-shadow: 0 8px 28px rgba(0, 0, 0, .07);
    z-index: 20;
}

.app-shell[data-chat-mode="chat"] .start-panel .gpt-composer textarea,
.app-shell.is-guest[data-chat-mode="chat"] .start-panel .gpt-composer textarea {
    height: 24px !important;
    min-height: 24px;
    max-height: 24px;
    padding: 0;
    line-height: 24px;
    overflow: hidden;
    font-size: 15px;
}

.app-shell[data-chat-mode="image"] .start-panel .gpt-composer textarea,
.app-shell.is-guest[data-chat-mode="image"] .start-panel .gpt-composer textarea {
    width: 100%;
    height: 28px !important;
    min-height: 28px;
    max-height: 28px;
    padding: 0 2px;
    line-height: 28px;
    overflow: hidden;
    font-size: 15px;
}

.start-panel .gpt-composer .composer-actions {
    position: absolute;
    pointer-events: none;
}

.app-shell[data-chat-mode="chat"] .start-panel .gpt-composer .composer-actions {
    inset: 0 11px;
    min-height: 56px;
}

.app-shell[data-chat-mode="image"] .start-panel .gpt-composer .composer-actions {
    left: 12px;
    right: 10px;
    bottom: 10px;
    min-height: 38px;
}

.start-panel .gpt-composer .left-tools,
.start-panel .gpt-composer .right-tools {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    pointer-events: auto;
}

.start-panel .gpt-composer .left-tools {
    left: 0;
    gap: 10px;
}

.start-panel .gpt-composer .right-tools {
    right: 0;
    gap: 10px;
}

.start-panel .gpt-composer .round-tool,
.dock-composer .gpt-composer .round-tool {
    width: 36px;
    height: 36px;
    border: 0;
    background: transparent;
    color: #111;
    font-size: 0;
    line-height: 0;
    text-indent: -9999px;
    overflow: hidden;
    position: relative;
}

.start-panel .gpt-composer .round-tool::before,
.start-panel .gpt-composer .round-tool::after,
.dock-composer .gpt-composer .round-tool::before,
.dock-composer .gpt-composer .round-tool::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 16px;
    height: 1.7px;
    border-radius: 999px;
    background: #202020;
    transform: translate(-50%, -50%);
}

.start-panel .gpt-composer .round-tool::after,
.dock-composer .gpt-composer .round-tool::after {
    transform: translate(-50%, -50%) rotate(90deg);
}

.start-panel .gpt-composer .composer-model,
.dock-composer .gpt-composer .composer-model {
    height: 32px;
    min-height: 32px;
    border: 0;
    border-radius: 8px;
    padding: 0 3px 0 8px;
    background: transparent;
    color: #111;
    box-shadow: none;
    gap: 5px;
    font-size: 14px;
    font-weight: 400;
    line-height: 1;
    align-items: center;
}

.start-panel .gpt-composer .composer-model:hover,
.dock-composer .gpt-composer .composer-model:hover {
    background: #f4f4f4;
}

.start-panel .gpt-composer .composer-model .chevron,
.dock-composer .gpt-composer .composer-model .chevron,
.ratio-chip .chevron {
    width: 16px;
    height: 16px;
    position: relative;
    display: inline-block;
    color: #8a8a8a;
    font-size: 0;
    line-height: 1;
    transform: none;
}

.start-panel .gpt-composer .composer-model .chevron::before,
.dock-composer .gpt-composer .composer-model .chevron::before,
.ratio-chip .chevron::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 46%;
    width: 7px;
    height: 7px;
    border-right: 1.6px solid currentColor;
    border-bottom: 1.6px solid currentColor;
    transform: translate(-50%, -50%) rotate(45deg);
}

.start-panel .gpt-composer .send-button,
.dock-composer .gpt-composer .send-button {
    width: 36px;
    height: 36px;
    background: #111;
    color: #fff;
    font-size: 18px;
}

.app-shell[data-chat-mode="image"] .start-panel .image-tool-chip {
    min-height: 34px;
    padding: 0 10px;
    border-radius: 999px;
    background: #eef4ff;
    color: #2563eb;
    font-size: 14px;
    font-weight: 500;
}

.app-shell[data-chat-mode="image"] .start-panel .ratio-chip {
    min-height: 34px;
    padding: 0 8px;
    border-radius: 999px;
    background: transparent;
    color: #111;
    font-size: 14px;
}

.app-shell[data-chat-mode="image"] .start-panel .ratio-chip::before {
    content: "";
    width: 13px;
    height: 8px;
    border: 1.6px solid currentColor;
    border-radius: 2px;
}

.attachment-menu {
    top: calc(100% + 8px);
    bottom: auto;
    left: 0;
    min-width: 232px;
    padding: 8px;
    border-color: #e4e4e4;
    border-radius: 14px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, .16), 0 2px 8px rgba(0, 0, 0, .06);
}

.attachment-menu button {
    min-height: 40px;
    border-radius: 9px;
    justify-content: flex-start;
    padding: 0 9px;
    gap: 10px;
    font-size: 14px;
}

.attachment-menu kbd {
    margin-left: auto;
    color: #9a9a9a;
    font: inherit;
}

.attach-upload-icon {
    width: 18px;
    height: 18px;
    position: relative;
    flex: 0 0 auto;
}

.attach-upload-icon::before {
    content: "";
    position: absolute;
    left: 5px;
    top: 2px;
    width: 8px;
    height: 13px;
    border: 1.6px solid #111;
    border-radius: 999px;
}

.attach-upload-icon::after {
    content: "";
    position: absolute;
    left: 8px;
    top: 5px;
    width: 4px;
    height: 8px;
    border-left: 1.6px solid #111;
}

.ratio-menu {
    top: calc(100% + 8px);
    bottom: auto;
    min-width: 174px;
    padding: 8px;
    border-color: #e4e4e4;
    border-radius: 14px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, .16), 0 2px 8px rgba(0, 0, 0, .06);
    z-index: 1000;
}

.ratio-title {
    padding: 6px 8px 8px;
    color: #8a8a8a;
    font-size: 13px;
}

.ratio-menu button {
    min-height: 36px;
    border-radius: 8px;
    justify-content: flex-start;
    gap: 10px;
    padding: 0 8px;
    font-size: 14px;
}

.ratio-icon {
    width: 15px;
    height: 11px;
    border: 1.5px solid #111;
    border-radius: 3px;
    flex: 0 0 auto;
}

.ratio-menu [data-ratio="1:1"] .ratio-icon {
    width: 14px;
    height: 14px;
}

.ratio-menu [data-ratio="3:4"] .ratio-icon,
.ratio-menu [data-ratio="9:16"] .ratio-icon {
    width: 12px;
    height: 17px;
}

.ratio-menu [data-ratio="4:3"] .ratio-icon,
.ratio-menu [data-ratio="16:9"] .ratio-icon {
    width: 17px;
    height: 11px;
}

.ratio-label {
    flex: 1 1 auto;
}

.ratio-check {
    margin-left: auto;
}

.app-shell[data-chat-mode="image"] .image-inspiration {
    margin-top: 26px;
}

.app-shell[data-chat-mode="image"] .inspiration-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
}

.app-shell[data-chat-mode="image"] .inspiration-upload,
.app-shell[data-chat-mode="image"] .inspiration-card {
    aspect-ratio: 1 / 1.16;
    border-radius: 16px;
}

.app-shell[data-chat-mode="image"] .inspiration-card:nth-child(5) {
    background: radial-gradient(circle at 50% 28%, #f1c4a2 0 12%, #7396d8 13% 32%, #1f2937 33% 68%, #111 100%);
}

.app-shell[data-chat-mode="image"] .start-panel .gpt-composer:has(.attachment-chip) {
    height: auto;
    min-height: 210px;
    display: block;
    padding: 12px 14px 62px;
    border-radius: 24px;
}

.app-shell[data-chat-mode="image"] .start-panel .gpt-composer:has(.attachment-chip) .attachment-strip {
    min-height: 64px;
    display: flex;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0 0 10px;
    overflow: visible;
}

.app-shell[data-chat-mode="image"] .start-panel .gpt-composer:has(.attachment-chip) .attachment-chip {
    width: 144px;
    max-width: 144px;
    height: 64px;
    grid-template-columns: 44px minmax(0, 1fr) 24px;
    gap: 8px;
    padding: 6px;
    border-radius: 12px;
    flex: 0 0 auto;
}

.app-shell[data-chat-mode="image"] .start-panel .gpt-composer:has(.attachment-chip) .attachment-chip img,
.app-shell[data-chat-mode="image"] .start-panel .gpt-composer:has(.attachment-chip) .file-chip-icon {
    width: 44px;
    height: 52px;
    border-radius: 8px;
}

.app-shell[data-chat-mode="image"] .start-panel .gpt-composer:has(.attachment-chip) textarea {
    position: absolute;
    left: 58px;
    right: 132px;
    bottom: 20px;
    width: auto;
    height: 24px !important;
    min-height: 24px;
    max-height: 24px;
    padding: 0;
    line-height: 24px;
    overflow: hidden;
}

.app-shell[data-chat-mode="image"] .start-panel .gpt-composer:has(.attachment-chip) .composer-actions {
    position: absolute;
    inset: auto 11px 14px;
    min-height: 36px;
    display: flex;
    pointer-events: none;
}

.dock-composer {
    width: min(768px, calc(100vw - var(--sidebar-width) - 64px));
}

.dock-composer .gpt-composer {
    width: 100%;
    height: 56px;
    min-height: 56px;
    display: flex;
    align-items: center;
    padding: 0 110px 0 58px;
    border: 1px solid #dfdfdf;
    border-radius: 28px;
    box-shadow: 0 8px 26px rgba(0, 0, 0, .07);
}

.dock-composer .gpt-composer textarea {
    height: 24px !important;
    min-height: 24px;
    max-height: 24px;
    padding: 0;
    line-height: 24px;
    overflow: hidden;
}

.dock-composer .gpt-composer .composer-actions {
    position: absolute;
    inset: 0 11px;
    min-height: 56px;
    pointer-events: none;
}

.dock-composer .gpt-composer .left-tools,
.dock-composer .gpt-composer .right-tools {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: auto;
}

.dock-composer .gpt-composer .left-tools {
    left: 0;
}

.dock-composer .gpt-composer .right-tools {
    right: 0;
}

/* Emergency polish after UI restore */
.app-shell.is-guest .chat-stage::after {
    content: "WlChat 是 AI。使用即表示你同意我们的条款和隐私政策。聊天内容可能会被审核，并用于改进我们的 AI 模型。了解更多";
}

/* Image mode attachments need a separate prompt row above the tool chips. */
.app-shell[data-chat-mode="image"] .start-panel .gpt-composer:has(.attachment-chip) {
    min-height: 164px;
    padding: 10px 12px 58px;
}

.app-shell[data-chat-mode="image"] .start-panel .gpt-composer:has(.attachment-chip) textarea {
    position: static;
    display: block;
    width: 100%;
    height: 26px !important;
    min-height: 26px;
    max-height: 26px;
    margin: 8px 0 0;
    padding: 0 2px;
    line-height: 26px;
    overflow: hidden;
}

.app-shell[data-chat-mode="image"] .start-panel .gpt-composer:has(.attachment-chip) .composer-actions {
    inset: auto 11px 11px;
}

.app-shell.sidebar-collapsed .sidebar {
    width: 56px;
}

.app-shell.sidebar-collapsed .sidebar-bottom {
    padding: 8px;
}

.app-shell.sidebar-collapsed .account-card {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    padding: 0;
    border-radius: 12px;
}

.app-shell.sidebar-collapsed .account-card .avatar {
    margin: 0;
}

.start-panel .gpt-composer .composer-model,
.dock-composer .gpt-composer .composer-model {
    height: 34px;
    min-width: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.start-panel .gpt-composer .composer-model-name,
.dock-composer .gpt-composer .composer-model-name {
    line-height: 18px;
}

.start-panel .gpt-composer .composer-model .chevron,
.dock-composer .gpt-composer .composer-model .chevron {
    width: 18px;
    height: 18px;
    margin-left: 1px;
    flex: 0 0 auto;
}

.start-panel .gpt-composer .composer-model .chevron::before,
.dock-composer .gpt-composer .composer-model .chevron::before,
.ratio-chip .chevron::before {
    width: 8px;
    height: 8px;
    border-width: 1.8px;
    top: 43%;
}

.model-menu {
    border-radius: 14px;
    padding: 6px;
    z-index: 1100;
}

.model-menu button {
    min-height: 38px;
    font-size: 14px;
    font-weight: 400;
}

.model-arrow {
    width: 20px;
    height: 20px;
    display: grid;
    place-items: center;
    font-size: 22px;
    line-height: 1;
}

.app-shell[data-chat-mode="image"] .start-panel .gpt-composer {
    overflow: visible;
}

.app-shell[data-chat-mode="image"] .start-panel .gpt-composer:has(.attachment-chip) {
    min-height: 0;
    height: auto;
    padding-bottom: 62px;
}

.app-shell[data-chat-mode="image"] .start-panel .gpt-composer:has(.attachment-chip) .attachment-strip {
    max-height: none;
    padding-right: 0;
}

.app-shell[data-chat-mode="image"] .start-panel .gpt-composer:has(.attachment-chip) + .suggestions + .image-inspiration,
.app-shell[data-chat-mode="image"] .start-panel .gpt-composer:has(.attachment-chip) ~ .image-inspiration {
    margin-top: 22px;
}

.attachment-menu,
.ratio-menu {
    z-index: 1200;
}

.app-shell[data-chat-mode="chat"] .start-panel .gpt-composer:has(.attachment-chip),
.app-shell[data-chat-mode="chat"] .dock-composer .gpt-composer:has(.attachment-chip) {
    height: auto;
    min-height: 132px;
    display: block;
    align-items: initial;
    padding: 12px 14px 62px;
    border-radius: 24px;
    overflow: visible;
}

.app-shell[data-chat-mode="chat"] .start-panel .gpt-composer:has(.attachment-chip) .attachment-strip,
.app-shell[data-chat-mode="chat"] .dock-composer .gpt-composer:has(.attachment-chip) .attachment-strip {
    display: flex;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 54px;
    margin: 0 0 10px;
    overflow: visible;
}

.app-shell[data-chat-mode="chat"] .start-panel .gpt-composer:has(.attachment-chip) .attachment-chip,
.app-shell[data-chat-mode="chat"] .dock-composer .gpt-composer:has(.attachment-chip) .attachment-chip {
    width: 126px;
    max-width: 126px;
    height: 54px;
    grid-template-columns: 42px minmax(0, 1fr) 22px;
    gap: 7px;
    padding: 5px;
    border-radius: 12px;
    flex: 0 0 auto;
}

.app-shell[data-chat-mode="chat"] .start-panel .gpt-composer:has(.attachment-chip) .attachment-chip img,
.app-shell[data-chat-mode="chat"] .start-panel .gpt-composer:has(.attachment-chip) .file-chip-icon,
.app-shell[data-chat-mode="chat"] .dock-composer .gpt-composer:has(.attachment-chip) .attachment-chip img,
.app-shell[data-chat-mode="chat"] .dock-composer .gpt-composer:has(.attachment-chip) .file-chip-icon {
    width: 42px;
    height: 42px;
    border-radius: 8px;
}

.app-shell[data-chat-mode="chat"] .start-panel .gpt-composer:has(.attachment-chip) .attachment-meta strong,
.app-shell[data-chat-mode="chat"] .dock-composer .gpt-composer:has(.attachment-chip) .attachment-meta strong {
    font-size: 12px;
    line-height: 16px;
}

.app-shell[data-chat-mode="chat"] .start-panel .gpt-composer:has(.attachment-chip) .attachment-meta span,
.app-shell[data-chat-mode="chat"] .dock-composer .gpt-composer:has(.attachment-chip) .attachment-meta span {
    font-size: 11px;
    line-height: 15px;
}

.app-shell[data-chat-mode="chat"] .start-panel .gpt-composer:has(.attachment-chip) .attachment-chip button,
.app-shell[data-chat-mode="chat"] .dock-composer .gpt-composer:has(.attachment-chip) .attachment-chip button {
    width: 22px;
    height: 22px;
    font-size: 17px;
}

.app-shell[data-chat-mode="chat"] .start-panel .gpt-composer:has(.attachment-chip) textarea,
.app-shell[data-chat-mode="chat"] .dock-composer .gpt-composer:has(.attachment-chip) textarea {
    position: absolute;
    left: 58px;
    right: 126px;
    bottom: 20px;
    width: auto;
    height: 24px !important;
    min-height: 24px;
    max-height: 24px;
    padding: 0;
    line-height: 24px;
    overflow: hidden;
}

.app-shell[data-chat-mode="chat"] .start-panel .gpt-composer:has(.attachment-chip) .composer-actions,
.app-shell[data-chat-mode="chat"] .dock-composer .gpt-composer:has(.attachment-chip) .composer-actions {
    position: absolute;
    inset: auto 11px 14px;
    min-height: 36px;
    display: flex;
    pointer-events: none;
}

@media (max-width: 900px) {
    .app-shell[data-chat-mode="chat"] .start-panel,
    .app-shell.is-guest[data-chat-mode="chat"] .start-panel,
    .app-shell[data-chat-mode="image"] .start-panel,
    .app-shell.is-guest[data-chat-mode="image"] .start-panel,
    .dock-composer {
        width: min(768px, calc(100vw - 28px));
    }

    .app-shell[data-chat-mode="image"] .inspiration-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Final attachment composer alignment */
.app-shell[data-chat-mode="chat"] .start-panel .gpt-composer:has(.attachment-chip),
.app-shell[data-chat-mode="chat"] .dock-composer .gpt-composer:has(.attachment-chip),
.app-shell[data-chat-mode="image"] .start-panel .gpt-composer:has(.attachment-chip) {
    height: auto;
    min-height: 124px;
    display: block;
    padding: 10px 12px 54px;
    border-radius: 22px;
    background: #fff;
    overflow: visible;
    box-shadow: 0 8px 28px rgba(0, 0, 0, .06);
}

.app-shell[data-chat-mode="image"] .start-panel .gpt-composer:has(.attachment-chip) {
    min-height: 134px;
}

.app-shell[data-chat-mode="chat"] .start-panel .gpt-composer:has(.attachment-chip) .attachment-strip,
.app-shell[data-chat-mode="chat"] .dock-composer .gpt-composer:has(.attachment-chip) .attachment-strip,
.app-shell[data-chat-mode="image"] .start-panel .gpt-composer:has(.attachment-chip) .attachment-strip {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 8px;
    min-height: 60px;
    margin: 0 0 8px;
    padding: 0;
    overflow: visible;
}

.app-shell[data-chat-mode="chat"] .start-panel .gpt-composer:has(.attachment-chip) .attachment-chip,
.app-shell[data-chat-mode="chat"] .dock-composer .gpt-composer:has(.attachment-chip) .attachment-chip,
.app-shell[data-chat-mode="image"] .start-panel .gpt-composer:has(.attachment-chip) .attachment-chip {
    width: 132px;
    max-width: 132px;
    height: 60px;
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr) 22px;
    align-items: center;
    gap: 8px;
    padding: 6px;
    border: 1px solid #e6e6e6;
    border-radius: 13px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
    flex: 0 0 auto;
}

.app-shell[data-chat-mode="chat"] .start-panel .gpt-composer:has(.attachment-chip) .attachment-chip img,
.app-shell[data-chat-mode="chat"] .start-panel .gpt-composer:has(.attachment-chip) .file-chip-icon,
.app-shell[data-chat-mode="chat"] .dock-composer .gpt-composer:has(.attachment-chip) .attachment-chip img,
.app-shell[data-chat-mode="chat"] .dock-composer .gpt-composer:has(.attachment-chip) .file-chip-icon,
.app-shell[data-chat-mode="image"] .start-panel .gpt-composer:has(.attachment-chip) .attachment-chip img,
.app-shell[data-chat-mode="image"] .start-panel .gpt-composer:has(.attachment-chip) .file-chip-icon {
    width: 46px;
    height: 46px;
    border-radius: 9px;
    object-fit: cover;
}

.app-shell[data-chat-mode="chat"] .start-panel .gpt-composer:has(.attachment-chip) .attachment-meta strong,
.app-shell[data-chat-mode="chat"] .dock-composer .gpt-composer:has(.attachment-chip) .attachment-meta strong,
.app-shell[data-chat-mode="image"] .start-panel .gpt-composer:has(.attachment-chip) .attachment-meta strong {
    color: #111;
    font-size: 12px;
    line-height: 16px;
    font-weight: 600;
}

.app-shell[data-chat-mode="chat"] .start-panel .gpt-composer:has(.attachment-chip) .attachment-meta span,
.app-shell[data-chat-mode="chat"] .dock-composer .gpt-composer:has(.attachment-chip) .attachment-meta span,
.app-shell[data-chat-mode="image"] .start-panel .gpt-composer:has(.attachment-chip) .attachment-meta span {
    color: #6f6f6f;
    font-size: 11px;
    line-height: 15px;
}

.app-shell[data-chat-mode="chat"] .start-panel .gpt-composer:has(.attachment-chip) .attachment-chip button,
.app-shell[data-chat-mode="chat"] .dock-composer .gpt-composer:has(.attachment-chip) .attachment-chip button,
.app-shell[data-chat-mode="image"] .start-panel .gpt-composer:has(.attachment-chip) .attachment-chip button {
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    color: #6f6f6f;
    font-size: 17px;
    line-height: 1;
}

.app-shell[data-chat-mode="chat"] .start-panel .gpt-composer:has(.attachment-chip) textarea,
.app-shell[data-chat-mode="chat"] .dock-composer .gpt-composer:has(.attachment-chip) textarea,
.app-shell[data-chat-mode="image"] .start-panel .gpt-composer:has(.attachment-chip) textarea {
    position: absolute;
    left: 58px;
    right: 126px;
    bottom: 17px;
    width: auto;
    height: 24px !important;
    min-height: 24px;
    max-height: 24px;
    padding: 0;
    line-height: 24px;
    overflow: hidden;
}

.app-shell[data-chat-mode="chat"] .start-panel .gpt-composer:has(.attachment-chip) .composer-actions,
.app-shell[data-chat-mode="chat"] .dock-composer .gpt-composer:has(.attachment-chip) .composer-actions,
.app-shell[data-chat-mode="image"] .start-panel .gpt-composer:has(.attachment-chip) .composer-actions {
    position: absolute;
    inset: auto 11px 11px;
    min-height: 36px;
    display: flex;
    align-items: center;
    pointer-events: none;
}

.app-shell[data-chat-mode="chat"] .start-panel .gpt-composer:has(.attachment-chip) .left-tools,
.app-shell[data-chat-mode="chat"] .start-panel .gpt-composer:has(.attachment-chip) .right-tools,
.app-shell[data-chat-mode="chat"] .dock-composer .gpt-composer:has(.attachment-chip) .left-tools,
.app-shell[data-chat-mode="chat"] .dock-composer .gpt-composer:has(.attachment-chip) .right-tools,
.app-shell[data-chat-mode="image"] .start-panel .gpt-composer:has(.attachment-chip) .left-tools,
.app-shell[data-chat-mode="image"] .start-panel .gpt-composer:has(.attachment-chip) .right-tools {
    top: 50%;
    transform: translateY(-50%);
}

.app-shell[data-chat-mode="image"] .inspiration-upload {
    background: #f4f4f4;
    border: 0;
    box-shadow: none;
}

.app-shell[data-chat-mode="image"] .inspiration-upload span {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    color: #303030;
    font-size: 28px;
    font-weight: 300;
    line-height: 1;
}

.app-shell[data-chat-mode="image"] .inspiration-upload strong {
    color: #5f5f5f;
    font-size: 14px;
    font-weight: 400;
}

.app-shell.is-guest .chat-stage::after {
    content: "WlChat 是 AI。使用即表示你同意我们的条款和隐私政策。聊天内容可能会被审核，并用于改进我们的 AI 模型。了解更多";
}

/* Absolute final fix: image attachment prompt must not sit under tool chips. */
.app-shell[data-chat-mode="image"] .start-panel form.gpt-composer:has(.attachment-chip) {
    min-height: 164px !important;
    height: auto !important;
    padding: 10px 12px 58px !important;
}

.app-shell[data-chat-mode="image"] .start-panel form.gpt-composer:has(.attachment-chip) textarea {
    position: static !important;
    display: block !important;
    width: 100% !important;
    height: 26px !important;
    min-height: 26px !important;
    max-height: 26px !important;
    margin: 8px 0 0 !important;
    padding: 0 2px !important;
    line-height: 26px !important;
    overflow: hidden !important;
}

.app-shell[data-chat-mode="image"] .start-panel form.gpt-composer:has(.attachment-chip) .composer-actions {
    position: absolute !important;
    inset: auto 11px 11px !important;
}

/* ChatGPT-like account menu */
.sidebar-bottom {
    padding: 8px 6px 10px;
    position: relative;
}

.account-card {
    width: 100%;
    min-height: 52px;
    border: 0;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 8px;
    background: #ececec;
    color: #0d0d0d;
    cursor: pointer;
}

.account-card:hover,
.account-card[aria-expanded="true"] {
    background: #ececec;
}

.account-card .avatar,
.account-menu-profile .avatar {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    overflow: hidden;
    background: #27c39f;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    flex: 0 0 auto;
}

.account-card .avatar img,
.account-menu-profile .avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.account-info {
    flex: 1 1 auto;
    min-width: 0;
    text-align: left;
}

.account-name {
    color: #0d0d0d;
    font-size: 14px;
    font-weight: 500;
    line-height: 18px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-badge {
    color: #8a6b00;
    font-size: 12px;
    line-height: 16px;
}

.account-store-icon {
    width: 18px;
    height: 18px;
    border: 1.6px solid #8f8f8f;
    border-radius: 4px 4px 5px 5px;
    position: relative;
    flex: 0 0 auto;
}

.account-store-icon::before {
    content: "";
    position: absolute;
    left: 4px;
    top: -3px;
    width: 8px;
    height: 7px;
    border: 1.6px solid #8f8f8f;
    border-bottom: 0;
    border-radius: 6px 6px 0 0;
    background: transparent;
}

.account-store-icon::after {
    content: "";
    position: absolute;
    left: 4px;
    top: 5px;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: #8f8f8f;
    box-shadow: 7px 0 0 #8f8f8f;
}

.account-menu {
    position: absolute;
    left: 8px;
    right: -4px;
    bottom: calc(100% - 8px);
    padding: 8px;
    border: 1px solid #e3e3e3;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 12px 28px rgba(0, 0, 0, .14);
    z-index: 1300;
}

.account-menu button {
    width: 100%;
    min-height: 38px;
    border: 0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 10px;
    background: transparent;
    color: #111;
    font-size: 14px;
    text-align: left;
    cursor: pointer;
}

.account-menu button:hover {
    background: #f2f2f2;
}

.account-menu-profile {
    min-height: 46px !important;
    margin-bottom: 6px;
}

.account-menu-user {
    flex: 1 1 auto;
    min-width: 0;
    display: grid;
    line-height: 1.1;
}

.account-menu-user strong,
.account-menu-user small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-menu-user strong {
    font-size: 14px;
    font-weight: 500;
}

.account-menu-user small {
    margin-top: 3px;
    color: #767676;
    font-size: 12px;
}

.menu-divider {
    height: 1px;
    margin: 6px 8px;
    background: #e7e7e7;
}

.menu-icon-inline {
    width: 18px;
    height: 18px;
    display: inline-block;
    position: relative;
    flex: 0 0 auto;
    color: #111;
}

.account-menu-arrow {
    margin-left: auto;
    color: #111;
    font-size: 22px;
    line-height: 1;
}

.account-icon-upgrade::before {
    content: "";
    position: absolute;
    inset: 4px;
    border: 1.4px solid currentColor;
    transform: rotate(45deg);
}

.account-icon-personalize::before {
    content: "";
    position: absolute;
    left: 8px;
    top: 2px;
    width: 2px;
    height: 14px;
    background: currentColor;
    border-radius: 999px;
}

.account-icon-personalize::after {
    content: "";
    position: absolute;
    left: 2px;
    top: 8px;
    width: 14px;
    height: 2px;
    background: currentColor;
    border-radius: 999px;
    transform: rotate(45deg);
}

.account-icon-profile::before {
    content: "";
    position: absolute;
    left: 6px;
    top: 3px;
    width: 6px;
    height: 6px;
    border: 1.4px solid currentColor;
    border-radius: 50%;
}

.account-icon-profile::after {
    content: "";
    position: absolute;
    left: 3px;
    bottom: 2px;
    width: 12px;
    height: 7px;
    border: 1.4px solid currentColor;
    border-radius: 999px 999px 4px 4px;
}

.account-icon-settings::before {
    content: "";
    position: absolute;
    inset: 3px;
    border: 1.5px solid currentColor;
    border-radius: 50%;
}

.account-icon-settings::after {
    content: "";
    position: absolute;
    left: 7px;
    top: 7px;
    width: 4px;
    height: 4px;
    border: 1.4px solid currentColor;
    border-radius: 50%;
}

.account-icon-help::before {
    content: "?";
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    border: 1.4px solid currentColor;
    border-radius: 50%;
    font-size: 12px;
}

.account-icon-logout::before {
    content: "";
    position: absolute;
    left: 2px;
    top: 4px;
    width: 9px;
    height: 10px;
    border: 1.4px solid currentColor;
    border-right: 0;
    border-radius: 3px 0 0 3px;
}

.account-icon-logout::after {
    content: "";
    position: absolute;
    right: 1px;
    top: 8px;
    width: 9px;
    height: 1.5px;
    background: currentColor;
    box-shadow: 3px -3px 0 -1px currentColor, 3px 3px 0 -1px currentColor;
}

.account-menu-logout {
    color: #111 !important;
}

.app-shell.sidebar-collapsed .account-menu {
    left: 8px;
    right: auto;
    width: 248px;
}

/* Collapsed sidebar account menu should stay compact, not become an icon stack. */
.app-shell.sidebar-collapsed .sidebar-bottom {
    padding: 8px;
}

.app-shell.sidebar-collapsed .account-card {
    width: 40px;
    height: 40px;
    min-height: 40px;
    display: grid;
    place-items: center;
    padding: 0;
    border-radius: 12px;
    background: transparent;
}

.app-shell.sidebar-collapsed .account-card:hover {
    background: #ececec;
}

.app-shell.sidebar-collapsed .account-card .avatar {
    width: 28px;
    height: 28px;
}

.app-shell.sidebar-collapsed .account-card .account-info,
.app-shell.sidebar-collapsed .account-card .account-store-icon,
.app-shell.sidebar-collapsed .account-card .account-arrow {
    display: none !important;
}

.app-shell.sidebar-collapsed .account-menu {
    left: 52px;
    right: auto;
    bottom: 8px;
    width: 248px;
}

.app-shell.sidebar-collapsed .sidebar {
    overflow: visible !important;
    z-index: 1400;
}

.app-shell.sidebar-collapsed .account-menu {
    z-index: 1500;
}

.app-shell.sidebar-collapsed .account-menu .account-menu-user,
.app-shell.sidebar-collapsed .account-menu .account-menu-arrow,
.app-shell.sidebar-collapsed .account-menu button span:not(.avatar):not(.menu-icon-inline) {
    display: grid;
}

.app-shell.sidebar-collapsed .account-menu .menu-icon-inline {
    display: inline-block;
}

/* Dock composer image mode: keep prompt text above image/ratio chips. */
.app-shell[data-chat-mode="image"] .dock-composer form.gpt-composer {
    height: auto !important;
    min-height: 104px !important;
    display: block !important;
    padding: 14px 12px 58px !important;
    border-radius: 24px !important;
    overflow: visible !important;
}

.app-shell[data-chat-mode="image"] .dock-composer form.gpt-composer textarea {
    position: static !important;
    display: block !important;
    width: 100% !important;
    height: 28px !important;
    min-height: 28px !important;
    max-height: 28px !important;
    margin: 0 !important;
    padding: 0 2px !important;
    line-height: 28px !important;
    overflow: hidden !important;
}

.app-shell[data-chat-mode="image"] .dock-composer form.gpt-composer .composer-actions {
    position: absolute !important;
    inset: auto 11px 11px !important;
    min-height: 36px !important;
    display: flex !important;
    align-items: center !important;
    pointer-events: none;
}

.app-shell[data-chat-mode="image"] .dock-composer form.gpt-composer .left-tools,
.app-shell[data-chat-mode="image"] .dock-composer form.gpt-composer .right-tools {
    top: 50% !important;
    transform: translateY(-50%) !important;
    pointer-events: auto;
}

/* Sidebar spacing: match ChatGPT's quieter left rhythm. */
.sidebar {
    padding: 10px 8px !important;
}

.sidebar-top {
    height: 42px !important;
    padding: 0 4px !important;
    margin-bottom: 8px !important;
}

.sidebar-title {
    padding-left: 0 !important;
    font-size: 16px !important;
    font-weight: 600 !important;
}

.collapse-icon {
    width: 32px !important;
    height: 32px !important;
}

.new-chat,
.side-menu button,
.history-block button {
    padding-left: 10px !important;
    padding-right: 10px !important;
}

.history-block h2 {
    padding-left: 10px !important;
}

.app-shell.sidebar-collapsed .sidebar {
    padding: 10px 8px !important;
}

/* Mobile layout guardrails */
@media (max-width: 820px) {
    html,
    body {
        max-width: 100%;
        overflow-x: hidden;
    }

    .chat-stage {
        padding-left: 14px !important;
        padding-right: 14px !important;
    }

    .app-shell,
    .app-shell.is-guest {
        display: block !important;
        width: 100%;
        max-width: 100vw;
        min-height: 100dvh;
        overflow-x: clip;
    }

    .workspace,
    .app-shell.is-guest .workspace {
        width: 100%;
        min-height: 100dvh;
        margin-left: 0 !important;
    }

    .sidebar,
    .app-shell.is-guest .sidebar {
        position: fixed !important;
        left: 0;
        top: 0;
        bottom: 0;
        width: min(var(--sidebar-width), 82vw) !important;
        transform: translateX(-100%);
    }

    .app-shell[data-sidebar-open="true"] .sidebar {
        transform: translateX(0);
    }

    .app-shell.is-guest .mobile-scrim {
        display: none;
    }

    .app-shell.is-guest[data-sidebar-open="true"] .mobile-scrim {
        display: block;
    }

    .start-panel,
    .app-shell[data-chat-mode="chat"] .start-panel,
    .app-shell.is-guest[data-chat-mode="chat"] .start-panel,
    .app-shell[data-chat-mode="image"] .start-panel,
    .app-shell.is-guest[data-chat-mode="image"] .start-panel,
    .dock-composer {
        width: 100% !important;
        max-width: 768px !important;
    }

    .dock-composer .gpt-composer,
    .app-shell[data-chat-mode="image"] .dock-composer form.gpt-composer {
        width: 100% !important;
    }

    .account-menu {
        max-width: calc(100vw - 24px);
    }

    .app-shell.is-guest .chat-stage::after {
        left: 14px !important;
        right: 14px !important;
        width: auto;
    }

    .app-shell.is-guest .chat-stage {
        width: 100%;
        justify-items: stretch;
    }

    .app-shell.is-guest[data-chat-mode="chat"] .start-panel,
    .app-shell.is-guest[data-chat-mode="image"] .start-panel {
        justify-self: stretch;
        width: 100% !important;
        max-width: none !important;
        min-width: 0 !important;
        transform: translateY(-4vh) !important;
    }

    .app-shell.is-guest[data-chat-mode="chat"] .start-panel h1,
    .app-shell.is-guest[data-chat-mode="image"] .start-panel h1 {
        width: 100%;
        overflow-wrap: anywhere;
    }

    .app-shell.is-guest[data-chat-mode="chat"] .start-panel .gpt-composer {
        width: 100% !important;
        max-width: none !important;
        min-width: 0 !important;
        padding: 0 52px 0 48px !important;
    }

    .app-shell.is-guest[data-chat-mode="chat"] .start-panel .gpt-composer textarea {
        width: 100% !important;
        min-width: 0;
    }

    .app-shell.is-guest[data-chat-mode="chat"] .start-panel .composer-model {
        display: none;
    }

    .app-shell.is-guest[data-chat-mode="chat"] .start-panel .gpt-composer .composer-actions {
        inset: 0 8px !important;
    }

    .app-shell.is-guest[data-chat-mode="chat"] .start-panel .gpt-composer .left-tools {
        left: 0;
    }

    .app-shell.is-guest[data-chat-mode="chat"] .start-panel .gpt-composer .right-tools {
        right: 0;
        gap: 0;
    }
}
