
.resize-preview-card:hover .resize-hover-preview,
.resize-preview-card:focus-within .resize-hover-preview {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

#resizePreview .resize-hover-preview img,
#cartoonPreview .resize-hover-preview img {
    display: block;
    width: 100%;
    max-height: 340px;
    margin: 0;
    object-fit: contain;
    border-radius: 6px !important;
    box-shadow: none;
}

#resultPreview {
    min-height: 0;
    flex: 0 0 auto;
    display: grid;
    align-content: start;
    justify-items: center;
    gap: 10px;
    margin-top: 12px;
}

.result-figure {
    position: relative;
    width: fit-content;
    max-width: 100%;
    margin: 0;
}

#resultPreview .result-figure img {
    display: block;
    margin: 0 auto;
}

.protected-result-preview {
    user-select: none;
    -webkit-user-drag: none;
}

.protected-result-preview.is-loading {
    min-width: min(92vw, 360px);
    min-height: 220px;
    background: linear-gradient(135deg, #f7faff, #edf4ff);
}

.result-preview-loading {
    position: absolute;
    inset: 50% auto auto 50%;
    transform: translate(-50%, -50%);
    padding: 8px 12px;
    border-radius: 999px;
    color: #365675;
    background: rgba(255, 255, 255, .86);
    border: 1px solid rgba(211, 224, 240, .9);
    font-weight: 800;
    white-space: nowrap;
    pointer-events: none;
}

.result-figure.has-visual-watermark-fallback::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 140%;
    height: 72px;
    transform: translate(-50%, -50%) rotate(-45deg);
    background: rgba(255, 255, 255, .26) var(--preview-watermark-logo) center / 54px 54px repeat-x;
    opacity: .32;
    pointer-events: none;
}

.result-caption {
    margin-top: 9px;
    color: #475569;
    font-size: .94rem;
}

.result-title {
    margin-bottom: 8px;
    color: #3f4f63;
    font-weight: 700;
}

.result-meta-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    min-width: min(100%, 460px);
}

.result-meta-item {
    min-width: 0;
    padding: 8px 10px;
    border: 1px solid rgba(220, 229, 239, .94);
    border-radius: 7px;
    background: #f8fbff;
    text-align: left;
}

.result-meta-item span,
.result-meta-item strong {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.result-meta-item span {
    color: #7b8797;
    font-size: .76rem;
    font-weight: 750;
}

.result-meta-item strong {
    margin-top: 2px;
    color: #1f3148;
    font-size: .88rem;
    font-weight: 800;
}

.result-actions {
    width: min(100%, 560px);
    margin: 4px auto 0;
    padding: 10px;
    border: 1px solid rgba(220, 229, 239, .94);
    border-radius: 8px;
    display: flex;
    align-items: end;
    justify-content: center;
    gap: 8px;
    background: rgba(248, 251, 255, .94);
    box-shadow: 0 8px 20px rgba(30, 80, 160, .07);
}

.result-format-field {
    min-width: 112px;
    display: grid;
    gap: 4px;
    text-align: left;
}

.result-format-field span {
    color: #7b8797;
    font-size: .74rem;
    font-weight: 800;
}

.result-format-select {
    min-height: 40px;
    width: 100%;
    border-radius: 7px;
    font-weight: 750;
}

.result-icon-button {
    width: 42px;
    height: 42px;
    min-height: 42px;
    flex: 0 0 42px;
    padding: 0;
    border: 1px solid #dce7f4;
    display: inline-grid;
    place-items: center;
    color: var(--primary);
    background: #fff;
    box-shadow: none;
}

.result-icon-button:hover {
    color: #fff;
    border-color: var(--primary);
}

.result-icon-button svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.result-download-button {
    min-width: 128px;
    min-height: 42px;
    flex: 0 1 190px;
    padding: 10px 16px;
    background: var(--success);
}

#downloadBtn,
#resultPreview a {
    min-height: 42px;
    margin: 14px auto 0;
    border-radius: var(--radius);
    padding: 10px 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: var(--success);
    font-size: var(--font-size-heading);
    font-weight: 750;
    text-decoration: none;
    box-shadow: 0 8px 18px rgba(18, 153, 106, .18);
}

#framePreviewPopup {
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: rgba(255,255,255,.96);
    box-shadow: var(--shadow);
    transition: opacity .17s;
}

#framePreviewPopup img {
    display: block;
    max-width: 340px;
    max-height: 340px;
}

#inlineCropPanel {
    z-index: 120;
    max-width: none;
    padding: 16px;
    position: relative;
}

#inlineCropPanel .crop-stage {
    width: min(100%, 420px) !important;
    height: auto !important;
    aspect-ratio: 1 / 1;
    min-height: 220px;
    max-height: min(70vh, 420px);
    margin: auto;
    background: #f7f9fd;
    border-radius: var(--radius);
    overflow: hidden;
    position: relative;
}

#avatarToCropInline,
#selectedFrameInline,
#avatarToCrop,
#selectedFrame {
    width: 100% !important;
    max-width: 100% !important;
    height: auto;
    left: 0;
    top: 0;
    position: absolute;
}

#selectedFrameInline,
#selectedFrame {
    z-index: 2;
    pointer-events: none;
}

#avatarToCropInline,
#avatarToCrop {
    z-index: 1;
}

.crop-ratio-list {
    margin: 0 0 8px;
    padding: 0 2px 2px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    max-height: 76px;
    overflow: auto;
}

#inlineCropPanel label,
#cropModal label {
    min-height: 32px;
    margin: 0;
    padding: 5px 8px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    color: var(--muted);
    font-weight: 650;
    font-size: .92rem;
}

#cropModal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    padding: 10px;
    display: none;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: rgba(12, 23, 38, 0.42);
    animation: fadeIn .2s ease;
}

#cropModal > div {
    width: min(94vw, 760px);
    max-height: calc(100dvh - 20px);
    padding: 14px 16px;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-radius: var(--radius);
    background: #fff;
    box-shadow: 0 18px 48px rgba(10, 24, 43, .22);
}

#cropModal h4 {
    margin-bottom: 2px;
}

.crop-stage {
    width: min(100%, 560px) !important;
    height: auto !important;
    aspect-ratio: 1 / 1;
    margin: auto;
    overflow: hidden;
    border-radius: var(--radius);
    background: #f7f9fd;
}

#cropModal .crop-stage {
    width: min(100%, clamp(280px, calc(100dvh - 275px), 560px)) !important;
    flex: 0 0 auto;
}

#inlineCropPanel .crop-stage {
    width: min(100%, 420px) !important;
}

.crop-tool-row,
.crop-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    text-align: center;
}

.crop-tool-row {
    margin-top: 2px;
}

.crop-tool-row button {
    min-height: 34px;
    padding: 6px 10px;
    color: var(--primary);
    background: #eef5ff;
    box-shadow: none;
}

.crop-tool-row button:hover {
    color: #fff;
    background: var(--primary);
}

.crop-actions {
    margin: 2px 0 0;
}

.crop-actions button {
    min-height: 38px;
    padding: 8px 14px;
}

.crop-help-text {
    margin-top: 0;
    color: var(--muted);
    font-size: .88rem;
    line-height: 1.3;
    text-align: center;
}

.cropper-container {
    touch-action: none;
}

.cropper-view-box {
    outline: 2px solid rgba(37, 111, 217, .95) !important;
    outline-color: rgba(37, 111, 217, .95) !important;
}

.cropper-face {
    background: rgba(37, 111, 217, .08);
}

.cropper-dashed {
    border-color: rgba(255, 255, 255, .75) !important;
}

.cropper-line {
    background-color: rgba(37, 111, 217, .85) !important;
    opacity: 1 !important;
}

.cropper-point {
    width: 14px !important;
    height: 14px !important;
    border: 2px solid var(--primary);
    border-radius: 999px;
    background-color: #fff !important;
    opacity: 1 !important;
}

.cropper-point.point-se {
    width: 18px !important;
    height: 18px !important;
}

.frame-share-modal {
    position: fixed;
    inset: 0;
    z-index: 100001;
    padding: 18px;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(12, 23, 38, .46);
}

.frame-share-modal.is-open {
    display: flex;
}

.frame-share-dialog {
    width: min(92vw, 420px);
    max-height: calc(100dvh - 36px);
    padding: 16px;
    overflow: auto;
    border-radius: var(--radius);
    background: #fff;
    box-shadow: 0 18px 48px rgba(10, 24, 43, .22);
}

.frame-share-header {
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.frame-share-header h3 {
    margin: 0;
    font-size: 1.05rem;
}

.frame-share-close {
    width: 36px;
    height: 36px;
    min-height: 36px;
    padding: 0;
    display: grid;
    place-items: center;
    color: var(--muted);
    background: #eef4fb;
    box-shadow: none;
    font-size: 1.4rem;
}

#frameShareImage {
    width: min(100%, 280px);
    aspect-ratio: 1 / 1;
    margin: 0 auto 10px;
    display: block;
    object-fit: contain;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: 0 8px 22px rgba(30, 80, 160, .12);
}

.frame-modal-frame-name {
    max-width: min(100%, 280px);
    margin: 0 auto 8px;
    display: block;
    color: #1e5fae;
    font-weight: 850;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#frameShareHint {
    margin: 0 0 10px;
    color: var(--muted);
    font-size: .92rem;
    text-align: center;
}

#frameShareNote {
    margin: 0 0 6px;
    color: #111827;
    font-size: .84rem;
    font-style: italic;
    font-weight: 800;
    line-height: 1.35;
    text-align: center;
    word-break: break-word;
}

.frame-share-link-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 40px 40px;
    gap: 8px;
}

#frameShareLink {
    min-width: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 10px;
    color: var(--text);
    background: #f7f9fd;
}

.frame-share-link-row button {
    width: 40px;
    min-height: 40px;
    padding: 0;
    display: grid;
    place-items: center;
}

.frame-share-link-row button.is-copied {
    background: var(--success);
}

.frame-share-link-row svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

#frameShareUploadFocus {
    width: 100%;
    margin-top: 10px;
}

.trend-modal {
    position: fixed;
    inset: 0;
    z-index: 100000;
    padding: 18px;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(12, 23, 38, .46);
}

.trend-modal.is-open {
    display: flex;
}

.trend-dialog {
    width: min(94vw, 860px);
    max-height: 90vh;
    padding: 18px;
    overflow: auto;
    border-radius: var(--radius);
    background: #fff;
    box-shadow: 0 18px 48px rgba(10, 24, 43, .22);
}

.trend-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.trend-header h3 {
    margin: 0;
}

.trend-close {
    width: 40px;
    min-height: 40px;
    padding: 0;
    display: grid;
    place-items: center;
    background: #f3f6fa;
    color: #637083;
    box-shadow: none;
    font-size: 1.45rem;
}

.trend-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.trend-item {
    position: relative;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px;
    background: var(--surface-muted);
    color: var(--text);
    box-shadow: none;
    cursor: pointer;
    text-align: left;
}

.trend-item:focus-visible {
    outline: 3px solid rgba(37, 111, 217, .25);
    outline-offset: 2px;
}

.trend-item img {
    width: 100%;
    aspect-ratio: 1 / 1;
    display: block;
    object-fit: contain;
    border: 1px solid #d9e3ee;
    border-radius: var(--radius);
    background: #fff;
}

.trend-share-button {
    width: 32px;
    height: 32px;
    min-height: 32px;
    padding: 0;
    position: absolute;
    right: 14px;
    bottom: 72px;
    z-index: 2;
    display: grid;
    place-items: center;
    color: var(--primary);
    background: rgba(255,255,255,.95);
    border: 1px solid rgba(37, 111, 217, .18);
    border-radius: 999px;
    box-shadow: 0 4px 12px rgba(34, 44, 58, .14);
}

.trend-use-count {
    position: absolute;
    left: 14px;
    bottom: 72px;
    z-index: 2;
    max-width: calc(100% - 58px);
    padding: 3px 6px;
    border-radius: 999px;
    color: #fff !important;
    background: rgba(18, 35, 57, .72);
    font-size: 10px !important;
    font-weight: 850;
    line-height: 1;
    pointer-events: none;
}

.trend-item .trend-frame-name {
    position: absolute;
    top: 14px;
    left: 14px;
    right: 14px;
    z-index: 4;
    margin: 0;
    padding: 4px 7px;
    border-radius: 999px;
    color: #fff;
    background: rgba(30, 95, 174, .92);
    box-shadow: 0 4px 12px rgba(18, 35, 57, .16);
    font-size: 10px;
    font-weight: 850;
    line-height: 1.15;
    text-align: center;
    opacity: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transform: translateY(-4px);
    transition: opacity .16s ease, transform .16s ease;
    pointer-events: none;
}

.trend-item:hover .trend-frame-name,
.trend-item:focus-visible .trend-frame-name {
    opacity: 1;
    transform: translateY(0);
}

.trend-share-button:hover,
.trend-share-button.is-copied {
    color: #fff;
    background: var(--success);
}

.trend-share-button svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.trend-item strong,
.trend-item span {
    display: block;
    min-width: 0;
    margin-top: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.trend-empty {
    grid-column: 1 / -1;
    min-height: 120px;
    display: grid;
    place-items: center;
    color: var(--muted);
    font-weight: 700;
}

.trend-item strong {
    color: #1e5fae;
    font-size: .9rem;
}

.trend-item span {
    color: var(--muted);
    font-size: .82rem;
}

.trend-pagination {
    margin-top: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.trend-pagination button {
    min-height: 36px;
    padding: 7px 12px;
}

.trend-pagination span {
    color: var(--muted);
    font-weight: 750;
}

.home-welcome-modal {
    position: fixed;
    inset: 0;
    z-index: 220;
    padding: 18px;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(10, 18, 31, .52);
    backdrop-filter: blur(5px);
}

.home-welcome-modal.is-open {
    display: flex;
}

.home-welcome-dialog {
    position: relative;
    width: min(66vw, 1100px);
    max-width: calc(100vw - 28px);
    max-height: calc(100dvh - 28px);
    display: grid;
    justify-items: center;
    gap: 14px;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.home-welcome-media {
    width: 100%;
    display: grid;
    place-items: center;
}

.home-welcome-media img,
.home-welcome-media video {
    width: 100%;
    max-height: min(74dvh, 720px);
    display: block;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 26px 90px rgba(0, 0, 0, .32);
}

.home-welcome-close {
    position: absolute;
    z-index: 2;
    top: -12px;
    right: -12px;
    width: 42px;
    height: 42px;
    min-height: 42px;
    padding: 0;
    display: grid;
    place-items: center;
    color: #39506d;
    background: rgba(255, 255, 255, .92);
    border: 0;
    border-radius: 50%;
    box-shadow: 0 12px 28px rgba(17, 32, 52, .24);
}

.home-welcome-close svg,
.home-welcome-enter svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.home-welcome-enter {
    min-height: 44px;
    padding: 10px 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #fff;
    background: linear-gradient(135deg, #256fd9, #1ab077);
    border: 0;
    border-radius: 999px;
    box-shadow: 0 18px 40px rgba(37, 111, 217, .28);
    font-family: var(--font-heading);
    font-weight: 850;
}

.home-logo-strip {
    width: min(100%, 1840px);
    margin: 0 auto;
    padding: 0 24px 12px;
}

.home-logo-strip-inner {
    position: relative;
    min-height: 92px;
    display: flex;
    align-items: center;
    overflow: hidden;
    border: 1px solid rgba(139, 192, 230, .72);
    border-radius: var(--radius);
    background: linear-gradient(135deg, #0f78ba, #1e9ad0);
    box-shadow: 0 8px 22px rgba(28, 48, 76, .08);
}

.home-logo-strip-inner.has-bg {
    background-image: linear-gradient(135deg, rgba(15, 120, 186, .72), rgba(30, 154, 208, .68)), var(--logo-strip-bg);
    background-position: center;
    background-size: cover;
}

.home-logo-strip-inner::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(90deg, rgba(15, 120, 186, .88), transparent 14%, transparent 86%, rgba(15, 120, 186, .88));
}

.home-logo-strip-track {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 44px;
    width: max-content;
    min-width: 200%;
    padding: 16px 44px;
    animation: homeLogoMarquee var(--logo-strip-speed, 36s) linear infinite;
    will-change: transform;
}

.home-logo-strip-inner:hover .home-logo-strip-track {
    animation-play-state: paused;
}

.home-logo-strip-item {
    flex: 0 0 auto;
    min-width: 96px;
    height: 58px;
    display: grid;
    place-items: center;
}

.home-logo-strip-item img {
    max-width: 132px;
    max-height: 58px;
    display: block;
    object-fit: contain;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .12));
}

@keyframes homeLogoMarquee {
    from {
        transform: translateX(-50%);
    }
    to {
        transform: translateX(0);
    }
}

.site-footer {
    width: min(100%, 1840px);
    margin: 0 auto;
    padding: 0 24px 22px;
}

.site-footer-inner {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: rgba(255, 255, 255, .72);
    box-shadow: 0 6px 18px rgba(28, 48, 76, 0.05);
}

.site-footer-brand {
    min-width: 0;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
}

.site-footer-logo {
    width: 42px;
    height: 42px;
    display: block;
    object-fit: contain;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 4px 12px rgba(28, 48, 76, .08);
}

.site-footer-copy {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.site-footer strong {
    color: #1e5fae;
    font-family: var(--font-heading);
    font-size: var(--font-size-heading);
    font-weight: 800;
}

.site-footer-copy span {
    color: var(--muted);
    font-size: .92rem;
}

.site-footer-actions {
    min-width: 0;
    display: grid;
    justify-items: end;
    gap: 8px;
}

