#mine-view {
    background-color: #f7f7f7;
    min-height: 100%;
    padding: calc(16px + env(safe-area-inset-top, 0px)) 0 24px;
    box-sizing: border-box;
    position: relative;
}

.mine-root {
    min-height: 100%;
}

.beautify-app-root,
.beautify-standalone-root {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 100%;
    background: #faf9f8;
}

.mine-header {
    background-color: #ffffff;
    display: flex;
    align-items: center;
    padding: 20px 16px;
    margin-bottom: 12px;
}

.mine-header-avatar {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    background-color: #e5e5e5;
    overflow: hidden;
    flex-shrink: 0;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    transition: transform 120ms ease;
}

.mine-header-avatar:active {
    transform: scale(0.97);
}

.mine-header-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.mine-header-info {
    margin-left: 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.mine-header-name {
    font-size: 18px;
    font-weight: 600;
    color: #111111;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}

.mine-header-signature {
    font-size: 12px;
    color: #888888;
    margin-top: 6px;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}

.mine-avatar-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.mine-edit-overlay {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: calc(18px + env(safe-area-inset-top, 0px)) 18px calc(18px + var(--safe-bottom-compact, env(safe-area-inset-bottom, 0px)));
    box-sizing: border-box;
    background: rgba(0, 0, 0, 0.18);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 30;
}

.mine-edit-card {
    width: min(340px, calc(100% - 24px));
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.18);
    padding: 18px 16px 14px;
    box-sizing: border-box;
}

.mine-edit-title {
    font-size: 16px;
    font-weight: 650;
    color: #111;
    letter-spacing: 0.02em;
    margin-bottom: 12px;
    text-align: left;
}

.mine-edit-input,
.mine-edit-textarea {
    width: 100%;
    border-radius: 14px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    background: rgba(247, 247, 247, 0.92);
    color: #111;
    font-size: 14px;
    padding: 12px 12px;
    box-sizing: border-box;
    outline: none;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.mine-edit-textarea {
    resize: none;
    line-height: 1.4;
    min-height: 78px;
}

.mine-edit-actions {
    margin-top: 14px;
    display: flex;
    gap: 10px;
}

.mine-edit-btn {
    flex: 1;
    height: 42px;
    border-radius: 14px;
    font-size: 14px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    background: rgba(255, 255, 255, 0.9);
    color: #111;
    cursor: pointer;
    transition: transform 120ms ease, background 120ms ease;
}

.mine-edit-btn:active {
    transform: scale(0.98);
}

.mine-edit-save {
    background: #111;
    color: #fff;
    border-color: rgba(0, 0, 0, 0.12);
}

.mine-edit-save:active {
    background: #000;
}

.mine-list-section {
    margin: 8px 12px 0;
    background-color: #ffffff;
    border-radius: 12px;
    overflow: hidden;
}

.mine-list-item {
    display: flex;
    align-items: center;
    padding: 0 16px;
    height: 56px;
    font-size: 15px;
    color: #111111;
}

.mine-list-item:active {
    background-color: #f0f0f0;
}

.mine-item-icon {
    width: 24px;
    display: flex;
    justify-content: center;
    margin-right: 16px;
    color: #333333;
    font-size: 20px;
}

.mine-item-text {
    flex: 1;
}

.mine-item-arrow {
    font-size: 18px;
    color: #c0c0c0;
}

.mine-list-section + .mine-list-section {
    margin-top: 12px;
}

.mine-favorites-panel {
    position: absolute;
    inset: 0;
    background: #f7f7f7;
    padding: env(safe-area-inset-top, 0px) 0 var(--safe-bottom-compact, env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
}

.mine-favorites-header {
    height: 52px;
    display: flex;
    align-items: center;
    padding: 0 16px;
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0,0,0,0.06);
}

.mine-favorites-back {
    width: 40px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    font-size: 24px;
    color: #111;
    user-select: none;
    -webkit-user-select: none;
    cursor: pointer;
}

.mine-favorites-title {
    flex: 1;
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    color: #111;
}

.mine-favorites-spacer {
    width: 40px;
    height: 36px;
}

.mine-favorites-list {
    padding: 12px;
    box-sizing: border-box;
}

.mine-favorites-empty {
    padding: 60px 12px;
    text-align: center;
    color: #9a9a9a;
    font-size: 14px;
}

.mine-fav-item {
    background: #fff;
    border-radius: 14px;
    padding: 12px;
    display: flex;
    gap: 10px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.06);
    border: 1px solid rgba(0,0,0,0.04);
}

.mine-fav-item + .mine-fav-item {
    margin-top: 10px;
}

.mine-fav-item:active {
    transform: scale(0.98);
}

.mine-fav-avatar {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: #eaeaea;
    overflow: hidden;
    flex-shrink: 0;
}

.mine-fav-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.mine-fav-main {
    flex: 1;
    min-width: 0;
}

.mine-fav-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.mine-fav-name {
    font-size: 14px;
    font-weight: 600;
    color: #111;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mine-fav-time {
    font-size: 12px;
    color: #9a9a9a;
    flex-shrink: 0;
}

.mine-fav-content {
    margin-top: 6px;
    font-size: 13px;
    line-height: 1.35;
    color: #444;
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.theme-studio-panel {
    position: absolute;
    inset: 0;
    background: #faf9f8;
    padding: env(safe-area-inset-top, 0px) 0 var(--safe-bottom-compact, env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
    z-index: 26;
    display: flex;
    flex-direction: column;
}

.theme-studio-header {
    height: 56px;
    display: flex;
    align-items: center;
    padding: 0 14px;
    box-sizing: border-box;
    background: rgba(250, 249, 248, 0.94);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.theme-studio-back {
    width: 42px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    font-size: 26px;
    color: #1b1b1b;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}

.theme-studio-title {
    flex: 1;
    text-align: center;
    font-size: 16px;
    font-weight: 700;
    color: #1b1b1b;
    letter-spacing: 0.02em;
}

.theme-studio-save {
    height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid rgba(196, 156, 153, 0.32);
    background: rgba(196, 156, 153, 0.16);
    color: #7c5a58;
    font-size: 12px;
    font-weight: 650;
    cursor: pointer;
}

.theme-studio-save:active {
    transform: scale(0.98);
}

.theme-studio-main {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.theme-studio-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 14px 12px 18px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.theme-studio-panel[data-theme-current="bubble"] .theme-studio-scroll {
    padding-bottom: 18px;
}

.theme-studio-panel[data-theme-current="home"] .theme-preview-dock {
    display: none;
}

.theme-studio-panel[data-theme-current="global"] .theme-bubble-preview-box {
    display: none;
}

.theme-studio-panel[data-theme-current="bubble"] .theme-global-preview-box {
    display: none;
}

.theme-studio-save[hidden],
.theme-studio-page[hidden],
.theme-studio-home[hidden] {
    display: none !important;
}

.theme-studio-home,
.theme-studio-page {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.theme-studio-home {
    padding-top: 6px;
}

.theme-home-card {
    width: 100%;
    min-height: 132px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 16px 42px rgba(0, 0, 0, 0.07);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 16px;
    box-sizing: border-box;
    text-align: left;
    color: #1b1b1b;
    cursor: pointer;
}

.theme-home-card:active {
    transform: scale(0.99);
}

.theme-home-icon {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 48px;
    background: rgba(196, 156, 153, 0.16);
    color: #7c5a58;
    font-size: 22px;
}

.theme-home-main {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.theme-home-title {
    font-size: 17px;
    line-height: 1.2;
    font-weight: 780;
    color: #1b1b1b;
}

.theme-home-desc {
    font-size: 12px;
    line-height: 1.55;
    color: rgba(0, 0, 0, 0.48);
}

.theme-home-arrow {
    font-size: 26px;
    color: rgba(0, 0, 0, 0.26);
    flex: 0 0 auto;
}

.theme-preview-dock {
    position: fixed;
    left: auto;
    right: 12px;
    bottom: calc(10px + var(--safe-bottom-compact, env(safe-area-inset-bottom, 0px)));
    width: 330px;
    max-width: calc(100vw - 24px);
    padding: 0;
    box-sizing: border-box;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    box-shadow: 0 18px 46px rgba(0, 0, 0, 0.2);
    z-index: 80;
    overflow: hidden;
    cursor: grab;
    touch-action: none;
    user-select: none;
    backdrop-filter: blur(18px) saturate(1.08);
    -webkit-backdrop-filter: blur(18px) saturate(1.08);
}

.theme-preview-dock.is-dragging {
    cursor: grabbing;
}

.theme-preview-float-handle {
    height: 28px;
    padding: 0 9px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    color: rgba(0, 0, 0, 0.68);
    font-size: 11px;
    font-weight: 750;
    letter-spacing: 0;
    background: rgba(255, 255, 255, 0.52);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    box-sizing: border-box;
}

.theme-preview-float-tip {
    color: rgba(0, 0, 0, 0.36);
    font-size: 10px;
}

.theme-card {
    background: rgba(255, 255, 255, 0.92);
    border-radius: 20px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.06);
    padding: 14px 14px 12px;
    box-sizing: border-box;
}

.theme-card-title {
    font-size: 13px;
    font-weight: 750;
    color: #1b1b1b;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.theme-card-title-row {
    margin-bottom: 12px;
}

.theme-subtle {
    color: rgba(0, 0, 0, 0.42);
    font-weight: 650;
    font-size: 12px;
}

.theme-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.theme-card .theme-row:first-of-type {
    border-top: none;
    padding-top: 0;
}

.theme-row-col {
    flex-direction: column;
    align-items: flex-start;
}

.theme-label {
    font-size: 12px;
    font-weight: 650;
    color: rgba(0, 0, 0, 0.74);
}

.theme-color-input {
    width: 40px;
    height: 34px;
    border: none;
    background: transparent;
    padding: 0;
}

.theme-range {
    width: 100%;
    accent-color: #c49c99;
}

.theme-css-textarea {
    width: 100%;
    min-height: 120px;
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: rgba(0, 0, 0, 0.03);
    font-size: 12px;
    line-height: 1.5;
    resize: vertical;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    box-sizing: border-box;
    color: rgba(0, 0, 0, 0.84);
    outline: none;
}

.theme-css-textarea:focus {
    border-color: rgba(196, 156, 153, 0.7);
    background: rgba(196, 156, 153, 0.08);
}

.theme-bubble-css-output {
    min-height: 220px;
    resize: vertical;
}

.theme-global-css-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.theme-global-css-actions .theme-mini-btn {
    flex: 1;
}

.theme-css-file-input {
    display: none;
}

.theme-css-file-note {
    margin-top: 8px;
    color: rgba(0, 0, 0, 0.42);
    font-size: 11px;
    line-height: 1.45;
}

.theme-global-css-presets {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.theme-css-preset-title {
    margin-bottom: 8px;
}

.theme-css-preset-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.theme-css-preset-card {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    border-radius: 14px;
    background: rgba(250, 249, 248, 0.85);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.theme-css-preset-card.is-previewing {
    border-color: rgba(196, 156, 153, 0.55);
    box-shadow: 0 12px 30px rgba(196, 156, 153, 0.16);
}

.theme-css-preset-card .theme-preset-apply {
    padding: 0 10px;
}

.theme-preset-apply.danger {
    border-color: rgba(255, 59, 48, 0.18);
    background: rgba(255, 59, 48, 0.08);
    color: #ff3b30;
}

.theme-danger-btn {
    width: 100%;
    height: 42px;
    border-radius: 14px;
    border: 1px solid rgba(255, 59, 48, 0.25);
    background: rgba(255, 59, 48, 0.1);
    color: #ff3b30;
    font-size: 13px;
    font-weight: 750;
    cursor: pointer;
}

.theme-danger-btn:active {
    transform: scale(0.99);
}

.theme-switch {
    position: relative;
    width: 46px;
    height: 28px;
    display: inline-flex;
    align-items: center;
}

.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.theme-switch-ui {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.12);
    transition: background 160ms ease;
}

.theme-switch-ui::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
    transition: transform 160ms ease;
}

.theme-switch input:checked + .theme-switch-ui {
    background: rgba(196, 156, 153, 0.8);
}

.theme-switch input:checked + .theme-switch-ui::after {
    transform: translateX(18px);
}

.theme-seg {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.theme-seg-btn {
    height: 34px;
    border-radius: 14px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    background: rgba(250, 249, 248, 0.9);
    color: rgba(0, 0, 0, 0.72);
    font-size: 12px;
    font-weight: 650;
    cursor: pointer;
}

.theme-seg-btn.is-active {
    border-color: rgba(196, 156, 153, 0.55);
    background: rgba(196, 156, 153, 0.18);
    color: #7c5a58;
}

.theme-seg-btn:active {
    transform: scale(0.99);
}

.theme-radius-block {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.theme-radius-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.theme-mini-btn {
    height: 30px;
    padding: 0 10px;
    border-radius: 999px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: rgba(0, 0, 0, 0.04);
    color: rgba(0, 0, 0, 0.7);
    font-size: 12px;
    font-weight: 650;
    cursor: pointer;
}

.theme-mini-btn:active {
    transform: scale(0.98);
}

.theme-radius-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px 12px;
}

.theme-radius-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.theme-radius-name {
    font-size: 11px;
    color: rgba(0, 0, 0, 0.5);
    font-weight: 650;
}

.theme-user-radius {
    margin-top: 10px;
}

.theme-preview-shell {
    background: transparent;
    border-radius: 0;
    border: none;
    box-shadow: none;
    padding: 8px;
    box-sizing: border-box;
}

.theme-global-preview-box {
    width: 100%;
}

.theme-global-preview-frame {
    display: block;
    width: 100%;
    height: 188px;
    border: 0;
    border-radius: 8px;
    background: #ffffff;
}

.theme-preview-box {
    background: #ffffff;
    border-radius: 8px;
    padding: 10px 11px;
    box-sizing: border-box;
    min-height: 188px;
    overflow: visible;
    --preview-ai-bg: #ffffff;
    --preview-ai-border: 1px solid rgba(0, 0, 0, 0.06);
    --preview-ai-backdrop: none;
    --preview-ai-shadow: none;
    --preview-ai-arrow: #ffffff;
    --preview-user-bg: #c49c99;
    --preview-user-border: none;
    --preview-user-backdrop: none;
    --preview-user-shadow: none;
    --preview-user-arrow: #c49c99;
    --preview-ai-radius-tl: 12px;
    --preview-ai-radius-tr: 12px;
    --preview-ai-radius-bl: 6px;
    --preview-ai-radius-br: 12px;
    --preview-user-radius-tl: 12px;
    --preview-user-radius-tr: 12px;
    --preview-user-radius-bl: 12px;
    --preview-user-radius-br: 6px;
    --preview-avatar-size: 40px;
    --preview-avatar-radius: 50%;
    --preview-avatar-gap: 4px;
    --preview-tail-top: 14px;
    --preview-tail-width: 6px;
    --preview-tail-height: 6px;
    --preview-ai-color: #000000;
    --preview-user-color: #000000;
}

.theme-preview-box .msg-row {
    margin-bottom: 8px;
    gap: 6px;
}

.theme-preview-box .msg-bubble {
    padding: var(--preview-bubble-pad-y, 9px) 8px;
    line-height: var(--preview-bubble-line-height, 1.5);
}

.theme-preview-dock .theme-preview-box {
    font-size: 12px;
}

.theme-preview-dock .theme-preview-box .msg-content-wrapper {
    max-width: 232px;
    min-width: 0;
    margin-left: 4px;
    margin-right: 4px;
}

.theme-preview-dock .theme-preview-box .msg-bubble {
    max-width: 100%;
    padding: var(--preview-bubble-pad-y, 9px) 10px;
    line-height: var(--preview-bubble-line-height, 1.38);
    font-size: 12px;
    word-break: break-word;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
}

.theme-preview-dock .theme-preview-box .msg-avatar-wrap {
    width: var(--preview-avatar-size, 32px);
    flex: 0 0 var(--preview-avatar-size, 32px);
}

.theme-preview-dock .theme-preview-box .msg-avatar {
    width: var(--preview-avatar-size, 32px);
    height: var(--preview-avatar-size, 32px);
}

.theme-preview-dock .theme-preview-box .msg-avatar-time,
.theme-preview-dock .theme-preview-box .msg-bubble-time,
.theme-preview-dock .theme-preview-box .msg-status-text {
    font-size: 9px;
    line-height: 1.2;
}

.theme-preview-dock .theme-preview-box .msg-avatar-time {
    top: calc(100% + 1px);
}

.theme-preview-dock .theme-preview-box .msg-status-text {
    margin-top: 2px;
    margin-right: 2px;
}

.theme-preview-dock .theme-preview-box[data-ts="1"][data-tspos="avatar"] .msg-row,
.theme-preview-dock .theme-preview-box[data-ts="1"][data-tspos="bubble"] .msg-row {
    padding-bottom: 11px;
}

.theme-preview-dock .theme-preview-box[data-ts="1"][data-tspos="bubble"] .msg-bubble {
    padding-bottom: 18px;
}

.theme-preview-dock .theme-preview-box[data-ts="1"][data-tspos="bubble"] .msg-bubble-time {
    bottom: -12px;
}

.theme-preview-box[data-ts="1"][data-tspos="bubble"] .msg-bubble-time {
    bottom: -14px;
    right: 0;
}

.theme-preview-box[data-ts="1"][data-tspos="bubble"] .msg-right .msg-bubble-time {
    right: auto;
    left: 0;
}

.theme-preview-box[data-ts="1"][data-tspos="bubble"] .msg-row {
    padding-bottom: 18px;
}

.theme-preview-box .msg-avatar {
    width: var(--preview-avatar-size);
    height: var(--preview-avatar-size);
    border-radius: var(--preview-avatar-radius);
}

.theme-preview-box[data-preview-avatar="0"] .msg-avatar,
.theme-preview-box[data-preview-avatar="0"] .msg-avatar-wrap {
    display: none;
}

.theme-preview-box[data-preview-avatar="0"] .msg-left .msg-bubble {
    margin-left: 0;
}

.theme-preview-box[data-preview-avatar="0"] .msg-right .msg-bubble {
    margin-right: 0;
}

.theme-preview-box[data-preview-avatar="0"] .msg-right .msg-content-wrapper {
    margin-right: 0;
}

.theme-preview-box[data-preview-avatar="0"] .msg-left .msg-content-wrapper {
    margin-left: 0;
}

.theme-preview-box .msg-left .msg-bubble {
    background: var(--preview-ai-bg);
    border: var(--preview-ai-border);
    box-shadow: var(--preview-ai-shadow);
    backdrop-filter: var(--preview-ai-backdrop);
    -webkit-backdrop-filter: var(--preview-ai-backdrop);
    border-top-left-radius: var(--preview-ai-radius-tl);
    border-top-right-radius: var(--preview-ai-radius-tr);
    border-bottom-left-radius: var(--preview-ai-radius-bl);
    border-bottom-right-radius: var(--preview-ai-radius-br);
    margin-left: var(--preview-avatar-gap);
    color: var(--preview-ai-color);
}

.theme-preview-box .msg-left .msg-bubble::before {
    content: "";
    display: block;
    position: absolute;
    top: var(--preview-tail-top);
    left: calc(var(--preview-tail-width) / -2);
    width: var(--preview-tail-width);
    height: var(--preview-tail-width);
    background: var(--preview-ai-tail-fill, var(--preview-ai-bg));
    border-left: var(--preview-ai-border);
    border-bottom: var(--preview-ai-border);
    transform: rotate(45deg);
    clip-path: polygon(0 0, 0 100%, 100% 100%);
    z-index: 1;
}

.theme-preview-box .msg-right .msg-bubble {
    background: var(--preview-user-bg);
    border: var(--preview-user-border);
    box-shadow: var(--preview-user-shadow);
    backdrop-filter: var(--preview-user-backdrop);
    -webkit-backdrop-filter: var(--preview-user-backdrop);
    border-top-left-radius: var(--preview-user-radius-tl);
    border-top-right-radius: var(--preview-user-radius-tr);
    border-bottom-left-radius: var(--preview-user-radius-bl);
    border-bottom-right-radius: var(--preview-user-radius-br);
    margin-right: var(--preview-avatar-gap);
    color: var(--preview-user-color);
}

.theme-preview-box .msg-right .msg-bubble::after {
    content: "";
    display: block;
    position: absolute;
    top: var(--preview-tail-top);
    right: calc(var(--preview-tail-width) / -2);
    width: var(--preview-tail-width);
    height: var(--preview-tail-width);
    background: var(--preview-user-tail-fill, var(--preview-user-bg));
    border-right: var(--preview-user-border);
    border-top: var(--preview-user-border);
    transform: rotate(45deg);
    clip-path: polygon(0 0, 100% 0, 100% 100%);
    z-index: 1;
}

.theme-preview-box[data-tail="0"] .msg-left .msg-bubble::before,
.theme-preview-box[data-tail="0"] .msg-right .msg-bubble::after {
    display: none;
}

.theme-preview-box[data-kkt="first"] .msg-row.msg-left + .msg-row.msg-left,
.theme-preview-box[data-kkt="last"] .msg-row.msg-left + .msg-row.msg-left {
    margin-top: 2px;
}

.theme-preview-box[data-kkt="first"] .msg-row.msg-left + .msg-row.msg-left .msg-avatar-wrap {
    opacity: 0;
    visibility: hidden;
}

.theme-preview-box[data-kkt="last"] .msg-row.msg-left:has(+ .msg-row.msg-left) .msg-avatar-wrap {
    opacity: 0;
    visibility: hidden;
}

.theme-preview-box[data-kkt="first"] .msg-row.msg-right + .msg-row.msg-right,
.theme-preview-box[data-kkt="last"] .msg-row.msg-right + .msg-row.msg-right {
    margin-top: 2px;
}

.theme-preview-box[data-kkt="first"] .msg-row.msg-right + .msg-row.msg-right .msg-avatar-wrap {
    opacity: 0;
    visibility: hidden;
}

.theme-preview-box[data-kkt="last"] .msg-row.msg-right:has(+ .msg-row.msg-right) .msg-avatar-wrap {
    opacity: 0;
    visibility: hidden;
}

.theme-preview-box[data-kkt="first"] .msg-row.msg-left + .msg-row.msg-left .msg-bubble::before,
.theme-preview-box[data-kkt="first"] .msg-row.msg-right + .msg-row.msg-right .msg-bubble::after,
.theme-preview-box[data-kkt="last"] .msg-row.msg-left + .msg-row.msg-left .msg-bubble::before,
.theme-preview-box[data-kkt="last"] .msg-row.msg-right + .msg-row.msg-right .msg-bubble::after {
    display: none;
}

.theme-preview-box[data-kkt="first"] .msg-row.msg-left + .msg-row.msg-left .msg-avatar-time,
.theme-preview-box[data-kkt="first"] .msg-row.msg-right + .msg-row.msg-right .msg-avatar-time,
.theme-preview-box[data-kkt="last"] .msg-row.msg-left + .msg-row.msg-left .msg-avatar-time,
.theme-preview-box[data-kkt="last"] .msg-row.msg-right + .msg-row.msg-right .msg-avatar-time {
    display: none;
}

.theme-preview-box[data-kkt="first"] .msg-row.msg-left + .msg-row.msg-left .msg-bubble-time,
.theme-preview-box[data-kkt="first"] .msg-row.msg-right + .msg-row.msg-right .msg-bubble-time,
.theme-preview-box[data-kkt="last"] .msg-row.msg-left + .msg-row.msg-left .msg-bubble-time,
.theme-preview-box[data-kkt="last"] .msg-row.msg-right + .msg-row.msg-right .msg-bubble-time {
    display: none;
}

.theme-preview-box[data-tail="0"] .msg-left .msg-bubble::before,
.theme-preview-box[data-tail="0"] .msg-right .msg-bubble::after {
    display: none;
}

.theme-preview-box[data-ts="1"][data-tspos="avatar"] .msg-row {
    padding-bottom: 14px;
}

.theme-preview-box[data-ts="1"][data-tspos="avatar"] .msg-avatar-time {
    display: block;
}

.theme-preview-box[data-ts="1"][data-tspos="bubble"] .msg-bubble {
    padding-bottom: 22px;
}

.theme-preview-box[data-ts="1"][data-tspos="bubble"] .msg-bubble-time {
    display: block;
}

.theme-preview-box[data-ts="1"][data-tspos="bubbleRight"] .msg-bubble-time {
    display: block;
    position: absolute;
    right: -40px;
    left: auto;
    bottom: 2px;
    font-size: 10px;
    color: #999;
    white-space: nowrap;
    animation: chatThemeTimestampSlide 0.6s ease-out both;
}

.theme-preview-box[data-ts="1"][data-tspos="bubbleRight"] .msg-right .msg-bubble-time {
    right: auto;
    left: -40px;
    text-align: right;
}

.theme-preview-box[data-read="0"] .msg-status-text {
    display: none;
}

.theme-preview-box[data-ts="1"][data-tspos="bubble"] .msg-right .msg-bubble-time {
    color: rgba(255, 255, 255, 0.82);
}

.theme-preview-box[data-ts="1"][data-tspos="bubble"] .msg-left .msg-bubble-time {
    color: rgba(0, 0, 0, 0.42);
}

.theme-preset-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.theme-empty {
    padding: 16px 2px;
    color: rgba(0, 0, 0, 0.45);
    font-size: 13px;
}

.theme-preset-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 12px;
    border-radius: 18px;
    background: rgba(250, 249, 248, 0.85);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.theme-preset-card.is-editing {
    border-color: rgba(196, 156, 153, 0.55);
    box-shadow: 0 16px 40px rgba(196, 156, 153, 0.18);
}

.theme-preset-main {
    flex: 1;
    min-width: 0;
}

.theme-preset-name {
    font-size: 13px;
    font-weight: 750;
    color: rgba(0, 0, 0, 0.86);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.theme-preset-meta {
    margin-top: 4px;
    font-size: 11px;
    color: rgba(0, 0, 0, 0.42);
    font-weight: 650;
}

.theme-preset-apply {
    height: 34px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid rgba(196, 156, 153, 0.35);
    background: rgba(196, 156, 153, 0.16);
    color: #7c5a58;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
}

.theme-preset-apply:active {
    transform: scale(0.98);
}

.theme-sheet,
.theme-picker {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 40;
}

.theme-sheet {
    align-items: flex-end;
    justify-content: center;
}

.theme-sheet-mask,
.theme-picker-mask {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.32);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.theme-sheet-panel {
    position: relative;
    width: 100%;
    padding: 12px 12px calc(12px + var(--safe-bottom-compact, env(safe-area-inset-bottom, 0px)));
    box-sizing: border-box;
    background: rgba(250, 249, 248, 0.96);
    border-radius: 22px 22px 0 0;
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 -18px 60px rgba(0, 0, 0, 0.22);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.theme-sheet-title {
    text-align: center;
    font-size: 13px;
    font-weight: 750;
    color: rgba(0, 0, 0, 0.62);
    padding: 6px 0 2px;
}

.theme-sheet-option,
.theme-sheet-cancel {
    height: 46px;
    border-radius: 18px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    background: rgba(255, 255, 255, 0.92);
    color: rgba(0, 0, 0, 0.82);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.theme-sheet-option:active,
.theme-sheet-cancel:active {
    transform: scale(0.99);
}

.theme-sheet-cancel {
    background: rgba(0, 0, 0, 0.04);
    color: rgba(0, 0, 0, 0.7);
}

.theme-picker {
    align-items: flex-end;
    justify-content: center;
}

.theme-picker-panel {
    position: relative;
    width: 100%;
    max-height: 84%;
    background: rgba(250, 249, 248, 0.96);
    border-radius: 22px 22px 0 0;
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 -18px 60px rgba(0, 0, 0, 0.22);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.theme-picker-header {
    height: 56px;
    display: flex;
    align-items: center;
    padding: 0 14px;
    box-sizing: border-box;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.theme-picker-back {
    width: 42px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    font-size: 26px;
    color: #1b1b1b;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}

.theme-picker-title {
    flex: 1;
    text-align: center;
    font-size: 15px;
    font-weight: 750;
    color: #1b1b1b;
}

.theme-picker-spacer {
    width: 42px;
    height: 40px;
}

.theme-picker-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.theme-role-item {
    border: 1px solid rgba(0, 0, 0, 0.05);
    background: rgba(255, 255, 255, 0.92);
    border-radius: 18px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    text-align: left;
}

.theme-role-item:active {
    transform: scale(0.99);
}

.theme-role-avatar {
    width: 38px;
    height: 38px;
    border-radius: 14px;
    object-fit: cover;
    background: rgba(0, 0, 0, 0.06);
    flex: 0 0 auto;
}

.theme-role-name {
    font-size: 14px;
    font-weight: 750;
    color: rgba(0, 0, 0, 0.86);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}
