#language-switcher {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 16px;
    padding-right: 32px;
}

#language-switcher::-ms-expand {
    display: none;
}

/* 只保留免费字体 */
@font-face {
    font-family: 'mplus1p';
    src: url('../fonts/MPLUS1p-Light.ttf') format('truetype');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'mplus1p';
    src: url('../fonts/MPLUS1p-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'mplus1p';
    src: url('../fonts/MPLUS1p-Medium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'bebasneue';
    src: url('../fonts/BebasNeue-Regular.ttf') format('truetype');
    font-display: swap;
}

@font-face {
    font-family: 'Kosugi Maru';
    src: url('../fonts/KosugiMaru-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

/* Kosugi Maru 字体调整 - 精确模拟 UDXinWan 的度量特性 */
.kosugi-maru-adjusted {
    /* 基础字体设置 */
    font-family: 'Kosugi Maru', sans-serif;
    
    /* 关键调整1: 行高调整 - 统一设置为2倍字号 */
    line-height: 2;
    
    /* 关键调整2: 轻微的字重增强 - 只使用text-stroke */
    font-weight: 400;  /* 使用原生字重，避免浏览器合成 */
    
    /* 轻微的text-stroke，接近UDXinWan的视觉粗细 */
    -webkit-text-stroke: 0.12px currentColor;
    text-stroke: 0.12px currentColor;
    
    /* 关键调整3: 主要通过spacing调整，减少transform使用 */
    /* 增加letter-spacing来补偿宽度差异，减少对transform的依赖 */
    letter-spacing: -0.045em;  /* 稍微增加字间距调整 */
    
    /* 关键调整4: 空格宽度调整 - 解决空格宽度差异问题 */
    word-spacing: -0.25em;  /* 稍微增加空格调整 */
    
    /* 关键调整5: 极轻微的水平调整，减少缩放感 */
    /* 减少scaleX的程度，避免明显的缩放感觉 */
    transform: scaleX(0.99);  /* 从0.98调整到0.99，减少缩放感 */
    transform-origin: center center;
    
    /* 优化渲染质量 */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    
    /* 防止字体变形 */
    font-feature-settings: "kern" 1;
    font-kerning: auto;
    
    /* 高级空格处理 - 使用CSS自定义属性进行精确控制 */
    --space-adjustment: -0.15em;
}

/* 针对不同字号的精确调整 - 只使用text-stroke，更清晰 */
.kosugi-maru-adjusted.size-8 {
    letter-spacing: -0.035em;
    -webkit-text-stroke: 0.08px currentColor;
    text-stroke: 0.08px currentColor;
}

.kosugi-maru-adjusted.size-13 {
    letter-spacing: -0.04em;
    -webkit-text-stroke: 0.1px currentColor;
    text-stroke: 0.1px currentColor;
}

.kosugi-maru-adjusted.size-14 {
    letter-spacing: -0.042em;
    -webkit-text-stroke: 0.1px currentColor;
    text-stroke: 0.1px currentColor;
}

.kosugi-maru-adjusted.size-20 {
    letter-spacing: -0.045em;
    -webkit-text-stroke: 0.12px currentColor;
    text-stroke: 0.12px currentColor;
}

.kosugi-maru-adjusted.size-24 {
    letter-spacing: -0.045em;
    -webkit-text-stroke: 0.14px currentColor;
    text-stroke: 0.14px currentColor;
}

.kosugi-maru-adjusted.size-28 {
    letter-spacing: -0.045em;
    -webkit-text-stroke: 0.16px currentColor;
    text-stroke: 0.16px currentColor;
}

/* 为预览元素应用精确调整 - 只使用text-stroke，更清晰 */
#preview-theme.kosugi-maru-font,
#preview-theme-line-2.kosugi-maru-font {
    font-family: 'Kosugi Maru', sans-serif;
    line-height: 2;
    letter-spacing: -0.035em;
    word-spacing: -0.2em;  /* 空格宽度调整 */
    font-weight: 400;  /* 使用原生字重 */
    
    /* 轻微的字体增强 - 只使用text-stroke */
    -webkit-text-stroke: 0.08px currentColor;
    text-stroke: 0.08px currentColor;
    
    transform: scaleX(0.99);  /* 减少缩放感 */
    transform-origin: center center;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: "kern" 1;
    font-kerning: auto;
}

#preview-name.kosugi-maru-font {
    font-family: 'Kosugi Maru', sans-serif;
    line-height: 2;
    letter-spacing: -0.045em;
    word-spacing: -0.25em;   /* 姓名中的空格调整更明显 */
    font-weight: 400;  /* 使用原生字重 */
    
    /* 轻微的字体增强 - 20px字号，只使用text-stroke */
    -webkit-text-stroke: 0.12px currentColor;
    text-stroke: 0.12px currentColor;
    
    transform: scaleX(0.99);  /* 减少缩放感 */
    transform-origin: center center;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: "kern" 1;
    font-kerning: auto;
}

#preview-romaji.kosugi-maru-font {
    font-family: 'Kosugi Maru', sans-serif;
    line-height: 2;
    letter-spacing: -0.04em;
    word-spacing: -0.22em;  /* 罗马字空格调整 */
    font-weight: 400;  /* 使用原生字重 */
    
    /* 轻微的字体增强 - 13px字号，只使用text-stroke */
    -webkit-text-stroke: 0.1px currentColor;
    text-stroke: 0.1px currentColor;
    
    transform: scaleX(0.99);  /* 减少缩放感 */
    transform-origin: center center;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: "kern" 1;
    font-kerning: auto;
}

body {
    font-family: 'Inter', 'Noto Sans SC', sans-serif;
    background-color: #f0f2f5;
}

.sakura-text-color {
    color: #F19DB5;
}

#main-title {
    font-weight: 700 !important;
    font-family: 'Inter', 'Noto Sans CJK JP', 'Noto Sans SC', sans-serif;
}

.aspect-photo {
    aspect-ratio: 89 / 127;
}

#photo-card {
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    background: #ddd;
    border-radius: 5px;
    outline: none;
    opacity: 0.7;
    transition: opacity .2s;
    margin-top: 4px;
    margin-bottom: 4px;
}

input[type="range"]:hover {
    opacity: 1;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: #8B5CF6;
    cursor: pointer;
    border-radius: 50%;
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #8B5CF6;
    cursor: pointer;
    border-radius: 50%;
}

details>summary {
    cursor: pointer;
    list-style: none;
}

details>summary::-webkit-details-marker {
    display: none;
}

.color-swatch {
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 9999px;
    cursor: pointer;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

#image-container {
    cursor: grab;
}

#image-container:active {
    cursor: grabbing;
}

#info-bar {
    position: relative;
    overflow: hidden;
}
.movable-block {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
}

/* Cropper Modal Styles */
#crop-modal, #save-modal {
    background-color: rgba(0, 0, 0, 0.8);
}
#crop-container {
    max-width: 90vw;
    max-height: 75vh;
}

#save-modal img {
    max-width: 90vw;
    max-height: 80vh;
}

.tick {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
}

.weight-btn.active-weight {
    background-color: #8B5CF6;
    color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* 折叠按钮样式 */
details[open] > summary svg {
    transform: rotate(180deg);
}

details > summary:hover svg {
    color: currentColor;
}

/* 主菜单按钮样式 */
details > summary {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    position: relative;
    background: transparent;
    border: none;
    border-radius: 6px;
    margin: 0;
    padding: 10px 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

details > summary:hover {
    background: rgba(139, 92, 246, 0.05);
    color: rgb(109 40 217);
}

details > summary:active {
    transform: scale(0.98);
}

/* 子菜单按钮特殊样式 */
details details > summary {
    background: transparent;
    border: none;
    margin: 2px 0 2px 16px;
    border-radius: 6px;
    position: relative;
    padding: 8px 12px;
    font-size: 0.9rem;
}

details details > summary::before {
    content: '';
    position: absolute;
    left: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 2px;
    height: 16px;
    background: #8b5cf6;
    border-radius: 1px;
}

details details > summary:hover {
    background: rgba(139, 92, 246, 0.08);
    color: rgb(109 40 217);
}

details details > summary:active {
    transform: scale(0.97);
}

/* 三级子菜单样式 */
details details details > summary {
    background: transparent;
    border: none;
    margin: 1px 0 1px 24px;
    border-radius: 4px;
    font-size: 0.85rem;
    padding: 6px 10px;
}

details details details > summary::before {
    left: -16px;
    width: 1px;
    height: 12px;
    background: #0ea5e9;
    border-radius: 1px;
}

details details details > summary:hover {
    background: rgba(14, 165, 233, 0.08);
    color: rgb(2, 132, 199);
}

/* 模块容器样式 */
.module-container {
    margin: 8px 0;
    padding: 0;
    position: relative;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 12px;
}

.module-container:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

/* 子模块内容区域样式 */
details > div {
    overflow: hidden;
    padding: 12px 0;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateY(-8px);
}

details[open] > div {
    max-height: 2000px;
    opacity: 1;
    transform: translateY(0);
}

details details > div {
    background: rgba(139, 92, 246, 0.02);
    border-left: 2px solid rgba(139, 92, 246, 0.2);
    border-radius: 0;
    margin-top: 4px;
    margin-left: 16px;
    padding: 8px 12px;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.25s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateY(-6px);
}

details details[open] > div {
    max-height: 1500px;
    opacity: 1;
    transform: translateY(0);
}

details details details > div {
    background: rgba(14, 165, 233, 0.02);
    border-left: 2px solid rgba(14, 165, 233, 0.2);
    border-radius: 0;
    margin-top: 4px;
    margin-left: 24px;
    padding: 6px 10px;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.15s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateY(-4px);
}

details details details[open] > div {
    max-height: 1000px;
    opacity: 1;
    transform: translateY(0);
}

/* 为输入控件添加更好的样式 */
input[type="text"], input[type="color"], select {
    transition: all 0.2s ease;
}

input[type="text"]:focus, select:focus {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.15);
}

/* 优化颜色选择器样式 */
.color-swatch:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* 优化滑块样式 */
input[type="range"]:hover {
    transform: translateY(-1px);
}

/* 为模块添加微妙的动画 */
.module-container {
    animation: fadeInUp 0.3s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 底部署名样式 */
footer {
    animation: fadeInUp 0.6s ease-out 0.3s both;
}

footer a {
    text-decoration: none;
    position: relative;
}

footer a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 1px;
    bottom: -2px;
    left: 50%;
    background-color: currentColor;
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

footer a:hover::after {
    width: 100%;
}

/* 响应式优化 */
@media (max-width: 768px) {
    .module-container {
        margin: 6px 0;
        padding-bottom: 8px;
    }

    details > summary {
        padding: 8px 10px;
    }

    details details > summary {
        margin-left: 12px;
        padding: 6px 10px;
    }

    details details details > summary {
        margin-left: 20px;
        padding: 4px 8px;
    }

    footer {
        margin-top: 8px;
        margin-bottom: 4px;
    }

    footer p {
        font-size: 0.8rem;
    }

    footer .text-xs {
        font-size: 0.7rem;
    }
}
