:root {
    --primary-color: #007AFF;
    --secondary-color: #FF9500;
    --text-color: #1d1d1f;
    --bg-color: #f5f5f7;
    --sidebar-bg: rgba(255, 255, 255, 0.8);
    --border-color: rgba(0, 0, 0, 0.1);
    --success-color: rgb(22 163 74);
    --error-color: #ef4444;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.5);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
    --base-font-size: 18px;
    font-size: var(--base-font-size);
    --serif-font: 'SanJiXingKai', 'PingFang SC', serif;
}

/* 三极行楷 - local()优先系统字体，无则下载woff2 */
@font-face {
    font-family: 'SanJiXingKai';
    src: url('./fonts/SanJiXingKai.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}
/* 方正楷体 - local()优先系统字体，无则下载woff2 */
@font-face {
    font-family: 'FZKaiTi';
    src: local('KaiTi'), local('楷体'), local('STKaiti'), local('华文楷体'), url('./fonts/FZKT.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}
.dark {
    --primary-color: #0A84FF;
    --secondary-color: #FF9F0A;
    --text-color: #f5f5f7;
    --bg-color: #1c1c1e;
    --sidebar-bg: rgba(44, 44, 46, 0.8);
    --border-color: rgba(255, 255, 255, 0.1);
    --success-color: #30D158;
    --error-color: #FF453A;
    --glass-bg: rgba(44, 44, 46, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
}

/* 【已注释】内容包装层 - 老粗布背景（做旧棉麻+缝线感）
.content-wrapper {
    background-image:
        /* 中等密度经纬编织纹 */
        repeating-linear-gradient(90deg,
            transparent 0px,
            rgba(150,135,110,0.065) 1px,
            transparent 2px,
            transparent 6px),
        repeating-linear-gradient(0deg,
            transparent 0px,
            rgba(150,135,110,0.055) 1px,
            transparent 2px,
            transparent 6px),
        /* 缝线痕迹 */
        linear-gradient(to right,
            transparent 0%,
            rgba(100,85,60,0.04) 15%,
            rgba(100,85,60,0.07) 50%,
            rgba(100,85,60,0.04) 85%,
            transparent 100%),
        /* 纤维质感 + 泛黄 */
        url("svg/background.svg"),
        /* 泛黄区域 */
        radial-gradient(ellipse at 18% 22%, rgba(180,155,100,0.07) 0%, transparent 38%),
        radial-gradient(ellipse at 78% 78%, rgba(175,150,95,0.06) 0%, transparent 35%);
    background-size: 6px 6px, 6px 6px, 100% 2px, 200px 200px, 100% 100%, 100% 100%;
    background-attachment: local, local, local, fixed, fixed, fixed;
    background-position: 0 0, 0 0, 0 42%, 0 0, 0 0, 0 0;
}
*/

/* 拼音模式区域（原始 - 无覆盖） */
.dark .icon-btn img,.dark .btn img,.dark .icon-small,.dark .svg24 {
    filter: brightness(0) invert(1);
}

.bg-blue-200,.bg-green-200 {
    color: #000000!important;
}

.dark .bg-blue-200,.dark .bg-green-200 {
    color: #000000!important;
}

.top-btn {
    background-color: #f8fafc!important;
}

.dark .top-btn {
    background-color: #0F172A!important;
    border: 1px solid rgb(255 255 255 / .2)!important;
}

.dark .icon-btn {
    background-color: #0F172A!important;
    border: 1px solid rgb(255 255 255 / .2)!important;
}

.dark .top-btn img {
    filter: none!important;
}

.dark .top-btn span {
    color: inherit!important;
}

.dark #toggleInputModeText {
    color: white!important;
}

.dark .answer-mode-text {
    color: white!important;
}

* {
    font-family: -apple-system,BlinkMacSystemFont,"SF Pro Display","SF Pro Text","Helvetica Neue",Helvetica,Arial,sans-serif;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
    letter-spacing: -.01em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: #fff0;
    touch-action: manipulation;
}

button,.btn,.top-btn,.icon-btn {
    touch-action: manipulation;
    -webkit-tap-highlight-color: #fff0;
}

body {
    background-color: var(--bg-color);
    background-image: url('svg/color.bg.png');
    background-size: auto;
    background-repeat: repeat;
    color: var(--text-color);
    transition: all 0.3s ease;
    overflow: hidden;
}

.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
}

.top-btn {
    background-color: var(--glass-bg)!important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-sm);
}

.dark .top-btn {
    background-color: var(--glass-bg)!important;
    border: 1px solid var(--glass-border)!important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeIn 0.4s cubic-bezier(.4,0,.2,1);
}

.animate-scale-in {
    animation: scaleIn 0.3s cubic-bezier(.4,0,.2,1);
}

.animate-slide-up {
    animation: slideUp 0.5s cubic-bezier(.4,0,.2,1);
}

.image-section img {
    transition: all 0.4s cubic-bezier(.4,0,.2,1);
}

.image-section img:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-md);
}

.content-section,
.writing-section {
    animation: fadeIn 0.5s cubic-bezier(.4,0,.2,1);
    font-family: var(--serif-font);
/*    font-size-adjust: 0.6;*/
}

/* 作者、诗句区域 - 三极行楷 */
.author-section,
.sentence-section {
    font-family: var(--serif-font);
/*    font-size-adjust: 0.6;*/
}

/* 诗名区域 - 三极行楷 */
.title-section,
.title-section * {
    font-family: var(--serif-font) !important;
    font-weight: 500 !important;
    /* font-size-adjust: 0.7 !important; */
}

.top-buttons {
    animation: slideUp 0.4s cubic-bezier(.4,0,.2,1);
}

.input-box {
    animation: fadeIn 0.3s cubic-bezier(.4,0,.2,1);
}

.modal {
    animation: scaleIn 0.3s cubic-bezier(.4,0,.2,1);
}

.modal-content {
    animation: fadeIn 0.4s cubic-bezier(.4,0,.2,1);
}

.completion-modal-content {
    width: 400px !important;
    height: 400px !important;
    padding-bottom: 30px !important;
    max-width: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-color);
    color: var(--text-color);
    border-radius: 1rem;
    padding: 20px;
}

.completion-modal-content .completion-stats {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    flex: 1;
    justify-content: center;
	padding-bottom: 15px;
}

.completion-modal-content #completionNextBtn,
.completion-modal-content #completionHintBtn {
    width: 80%;
    max-width: 300px;
    padding: 16px 32px;
    font-size: 22px;
    font-weight: 700;
}

.completion-modal-content #completionHintBtn {
    background-color: #f97316;
}

.main-container {
    animation: fadeIn 0.6s cubic-bezier(.4,0,.2,1);
}

.icon-btn:hover,.top-btn:hover,button,.btn,input,.input-box {
    transition: all 0.3s cubic-bezier(.4,0,.2,1);
}

.dark .icon-btn {
    background: var(--glass-bg)!important;
    border: 1px solid var(--glass-border)!important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

button:active,.btn:active {
    transform: scale(.98);
}

.poem-image:active {
    transform: scale(.98);
}

button:disabled,.btn:disabled {
    opacity: .5;
    cursor: not-allowed;
    transform: none;
}

.number {
    transition: all 0.2s cubic-bezier(.4,0,.2,1);
}

.number:hover {
    transform: scale(1.1);
}

.main-content {
    transition: all 0.3s ease;
}

.input-box {
    width: var(--input-width,52px);
    height: var(--input-height,62.4px);
    line-height: var(--line-height,62.4px);
    text-align: center;
    font-size: var(--input-font-size,31.2px);
    border-radius: 8px;
    background: transparent;
    transition: all 0.3s cubic-bezier(.4,0,.2,1);
    padding: 0;
    outline: none;
    margin: 0 var(--input-margin,5.2px);
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight:500;
    pointer-events: auto;
    cursor: pointer;
    font-family: var(--serif-font);
/*    font-size-adjust: 0.6;*/
    color: var(--text-color);
    min-width: var(--input-width,52px);
    min-height: var(--input-height,62.4px);
    caret-color: transparent;
}





input.input-box.punctuation-input,
input.input-box.punctuation-input:focus,
input.input-box.punctuation-input:focus-visible,
input.input-box.punctuation-input.active,
input.input-box.punctuation-input[readonly]:focus {
    border-bottom: none !important;
    background: transparent !important;
    outline: none !important;
}

.input-box:focus,
.input-box[readonly]:focus,
.input-box.active {
    outline: none;
    border-bottom: 2px solid var(--primary-color) !important;
/*    box-shadow: 0 0 0 3px rgb(0 122 255 / .2) !important;
    transform: translateY(-1px) !important;*/
    background: rgb(0 122 255 / .15) !important;
}

.input-box.correct {
    border-bottom-color: var(--success-color)!important;
    color: var(--success-color)!important;
}

.input-box.incorrect {
    border-color: var(--error-color)!important;
    color: var(--error-color)!important;
    background-color: rgb(255 59 48 / .1);
}

.input-box:disabled {
    opacity: 1;
    color: var(--text-color);
    border-color: var(--border-color);
    pointer-events: none;
}

.btn {
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    color: var(--text-color);
    background-color: var(--sidebar-bg);
}

.icon-btn {
    position: relative;
    transition: all 0.3s cubic-bezier(.4,0,.2,1);
    cursor: pointer;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
}

.icon-btn:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.icon-btn:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
    background: var(--glass-bg);
}

.icon-btn:active img {
    transform: scale(.92);
}

.dark .icon-btn {
    background: linear-gradient(145deg,#1e293b,#0f172a)!important;
    border: 1px solid rgb(255 255 255 / .2)!important;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / .3),0 2px 4px -1px rgb(0 0 0 / .2);
}

.dark .icon-btn:hover {
    box-shadow: 0 6px 8px -1px rgb(0 0 0 / .4),0 4px 6px -1px rgb(0 0 0 / .3);
}

.dark .icon-btn:active {
    box-shadow: 0 1px 3px rgb(0 0 0 / .4);
    background: linear-gradient(145deg,#0f172a,#1e293b)!important;
}

.svg24 {
    width: 24px;
    height: 24px;
}

.number {
    min-width: 35.2px;
    font-size: 16px!important;
}

.btn-sm {
    padding: 4px 8px;
    font-size: 14px;
    font-weight: 500;
}

.btn-primary {
    background-color: #2563eb;
    color: #fff;
}

.btn-primary:hover {
    opacity: .9;
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: #fff;
}

.btn-secondary:hover {
    opacity: .9;
}

.btn-outline {
    background-color: #fff0;
    border: 1px solid var(--border-color);
    color: var(--text-color);
}

.btn-outline:hover {
    background-color: var(--sidebar-bg);
}

.btn-danger {
    background-color: #ef4444;
    color: #fff;
}

.btn-danger-sm {
    background-color: #ef4444;
    color: #fff;
    padding: 4px 8px;
    font-size: 14px;
}

.modal-content .btn,.modal-content-flex .btn {
    font-size: 16px!important;
    padding: 8px 16px!important;
    font-weight: bold!important;
}

.modal-content .btn-danger-sm,.modal-content-flex .btn-danger-sm {
    font-size: 14px!important;
    padding: 6px 12px!important;
    font-weight: bold!important;
}

.btn-success {
    background-color: #10b981;
    color: #fff;
}

.modal-content-flex {
    display: flex;
    flex-direction: column;
}

.modal-content-small {
    width: 40vw;
    height: 50vh;
}

.modal-content-medium {
    height: auto!important;
    max-height: 80vh!important;
    display: block!important;
}

.img-rotate-270 {
    transform: rotate(270deg);
}

.position-select-content {
    padding-left: 2px;
    padding-right: 4px;
}

.color-btn {
    width: 48px;
    height: 32px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.icon-small {
    width: 24px;
    height: 24px;
    margin: 0 4px;
    vertical-align: middle;
    display: inline;
}

.clear-btn {
    padding: 8px 16px;
    border-radius: 4px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
}

#directoryTree {
    font-family: -apple-system,BlinkMacSystemFont,"SF Pro Display","Segoe UI",Roboto,sans-serif;
}

.directory-tree {
    list-style: none;
    padding: 0;
    margin: 0;
}

.directory-tree ul {
    list-style: none;
    padding-left: 3rem;
    margin: 0;
}

@media (max-width:768px) {
    .directory-tree ul {
        padding-left: 1.5rem;
    }

    .modal-content {
        width: 90vw!important;
    }

    .modal-content-small {
        width: 80vw;
        height: 60vh;
    }

    .top-buttons {
        flex-wrap: wrap;
    }

    .top-btn {
        padding: 6px 12px;
        font-size: 14px;
    }

    .input-box {
        width: var(--input-width,40px);
        height: var(--input-height,50px);
        line-height: var(--line-height,50px);
        font-size: var(--input-font-size,24px);
        margin: 0 var(--input-margin,4px);
    }
}

.directory-tree li {
    margin: 2px 0;
    padding: 4px 0;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    position: relative;
}

.directory-tree li:hover {
    background-color: rgb(0 122 255 / .05);
}

.tree-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
}

.tree-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tree-icon i {
    font-size: 14px;
}

.tree-toggle {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 4px;
    transition: transform 0.2s ease;
    cursor: pointer;
}

.tree-toggle.collapsed {
    transform: rotate(-90deg);
}

.directory-tree li.directory>.tree-item {
    font-weight: 500;
}

.directory-tree li.file.selected>.tree-item {
    background-color: rgb(0 122 255 / .1);
    color: #007AFF;
    font-weight: 500;
}

.dark #directoryTree {
    background-color: #2c2c2e;
    border-color: rgb(255 255 255 / .1);
}

.dark #directoryTree .text-center {
    color: #86868b;
}

.dark .directory-tree li:hover {
    background-color: rgb(255 255 255 / .05);
}

.dark .directory-tree li.file {
    color: #aeaeb2;
}

.dark .directory-tree li.file.selected>.tree-item {
    background-color: rgb(10 132 255 / .15);
    color: #0A84FF;
}

.mt-6 {
    margin-top: 24px;
}

.progress-fill {
    transition: width 0.3s ease;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgb(0 0 0 / .5);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    pointer-events: auto;
}

.modal-content {
    background-color: var(--bg-color);
    border-radius: 8px;
    padding: 24px;
    width: 80vw;
    height: 80vh;
    overflow: hidden;
    box-shadow: 0 10px 25px rgb(0 0 0 / .1);
    display: flex;
    flex-direction: column;
    color: var(--text-color);
}

.modal-content-flex {
    background-color: var(--bg-color);
    border-radius: 8px;
    padding: 24px;
    width: 80vw;
    height: 80vh;
    overflow: hidden;
    box-shadow: 0 10px 25px rgb(0 0 0 / .1);
    display: flex;
    flex-direction: column;
    color: var(--text-color);
}

.modal-content .file-input {
    margin-bottom: 16px;
}

input[type="file"]::file-selector-button {
    font-weight: 400;
}

input[type="file"] {
    font-weight: 400;
}

.modal-content .table-container {
    flex: 1;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--bg-color);
}

.modal-content-flex .table-container {
    flex: 1;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--bg-color);
}

.modal-content table,.modal-content-flex table {
    width: 100%;
    background-color: var(--bg-color);
    color: var(--text-color);
}

.modal-content table th:first-child,.modal-content table td:first-child,.modal-content-flex table th:first-child,.modal-content-flex table td:first-child {
    width: 60px;
    text-align: center;
    white-space: nowrap;
}

.modal-content table th:nth-child(2),.modal-content table td:nth-child(2),.modal-content-flex table th:nth-child(2),.modal-content-flex table td:nth-child(2) {
    text-align: left;
    flex: 1;
    /*min-width: 200px;*/
}

.modal-content table th:last-child,.modal-content table td:last-child,.modal-content-flex table th:last-child,.modal-content-flex table td:last-child {
    width: 80px;
    text-align: center;
    white-space: nowrap;
}

.modal-content table th,.modal-content table td,.modal-content-flex table th,.modal-content-flex table td {
    padding: 6px 8px;
    border-bottom: 1px solid var(--border-color);
    font-size: 16px!important;
    color: var(--text-color);
    transition: background-color 0.2s ease;
}

.modal-content table tr:hover,.modal-content-flex table tr:hover {
    background-color: rgb(255 255 255 / .1);
}

.modal-content table thead,.modal-content-flex table thead,
#importModal table thead,
#errorBookModal table thead,
#recordsModal table thead,
#readRecordsModal table thead,
#dictionaryRecordsModal table thead,
#hintRecordsModal table thead {
    background-color: var(--sidebar-bg);
    color: var(--text-color);
}

.modal-content table thead tr:hover,.modal-content-flex table thead tr:hover {
    background-color: var(--sidebar-bg);
}

.modal-content .button-group {
    margin-top: 16px;
}

.progress-bar {
    height: 6px;
    background-color: var(--border-color);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background-color: var(--success-color);
    transition: width 0.3s ease;
}

.poem-image {
    width: 100%;
    object-fit: contain;
    border-radius: 0;
    cursor: pointer;
}

select,input[type="text"],input[type="number"],textarea {
    padding:0;
    border-bottom: 2px solid #c4c4c4;
    border-radius: 0;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    color: var(--text-color);
    margin-top: 10px;
}

select:focus,input[type="text"]:focus,input[type="number"]:focus,textarea:focus {
    outline: none;
}

#settingsModal label {
    font-size: 18px;
    font-weight: 700;
    margin-right: 16px;
}

#settingsModal select {
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--bg-color);
    color: var(--text-color);
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    font-size: 18px;
}

#settingsModal select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgb(59 130 246 / .2);
}

#settingsModal input[type="number"] {
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-size: 18px;
}

label {
    font-size: 14px;
    font-weight: 500;
    display: block;
}

.form-group {
    margin-bottom: 16px;
}

.error-message {
    color: var(--error-color);
    font-size: 12px;
    margin-top: 4px;
}

.success-message {
    color: var(--success-color);
    font-size: 12px;
    margin-top: 4px;
}

@media (max-width:768px) {
    .main-content {
        margin-left: 0;
    }

    .menu-toggle {
        display: block;
    }
}

@media (max-aspect-ratio:1/1) {
	.pinyin-char-box{
		font-size: 26px !important;
        height: 36px !important;
		line-height: 36px !important;
    }
	.pinyin-input-container{
		min-height: 40px!important;;
		height: 40px!important;;
    }
	.bgcolor{
    }
	.max-w-md{        
	    max-height: 25vh;
        max-width: none !important;
    }
	.modal-content .button-group{
    }
    .clearErrors-btn {
    }

    .record-clearRecordsBtn {
        padding: 6px 12px!important;
        font-size: 14px!important;
    }

    #recordsTableBody img {
        width: 14px!important;
        height: 14px!important;
    }

    .hintModal-font {
        font-size: 20px!important;
    }

    .left-buttons {
        gap: 12px!important;
    }

    .right-buttons {
        gap: 10px!important;
    }

    #dictionaryModal .modal-content {
        width: 100vw !important;
        height: 100vh !important;
    }

    .author-section {
        align-items: center!important;
        min-height: auto!important;
        height: auto!important;
        margin: 0!important;
    }

    :root {
        font-size: 18px!important;
    }

    /* 竖屏模式下的导入确认弹窗 - 14px */
    #importConfirmModalContent,
    #importConfirmTable,
    #importConfirmTable th,
    #importConfirmTable td {
        font-size: 16px !important;
    }

    /* 竖屏模式下的搜索区域 */
    .bg-yellow-100 .flex.items-center {
        flex-wrap: wrap !important;
        gap: 8px !important;
    }
    .bg-yellow-100 span {
        white-space: nowrap !important;
        width: auto !important;
    }
    .bg-yellow-100 input {
        min-width: 0 !important;
        flex: 1 1 0% !important;
    }

    .main-container {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        padding-top: 0px!important;
        min-height: 100dvh;
        max-height: 100dvh;
        overflow: hidden;
        position: relative;
    }

    .main-container>div:first-of-type {
        display: flex;
        flex-direction: column;
        align-items: center;
        width: 100vw!important;
        margin-top: 0!important;
        flex: 1;
        padding-top:4px!important;
        overflow: hidden;
    }

    .image-section {
        padding: 0!important;
        width: 100vw!important;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding-top: 5px!important;
        height: auto!important;
        margin-top: 5px!important;
        max-height: 25vh;
    }

    .image-section img {
        object-fit: contain;
        border-radius: 1rem!important;
        height: auto;
        max-width: 100%;
        width: auto;
        max-height: 25vh;
    }

    .image-section>div:nth-child(2) {
        display: none;
    }

    .image-section>div:first-child {
        width: 100%;
        display: flex;
        justify-content: center;
        margin-bottom: 5px;
    }

    .content-section,
    .writing-section {
        width: 95vw!important;
        margin-top: 0!important;
		padding-top: 5px;
        padding: 0 10px;
        flex: 1;
        display: flex;
        flex-direction: column;
        overflow-y: auto;
        overflow-x: hidden;
    }

    .bottom-buttons {
        width: 100vw!important;
        display: flex!important;
        justify-content: center!important;
        flex-wrap: wrap!important;
        gap: 0px!important;
        background-color: var(--bg-color);
        margin: 0!important;
        z-index: 100;
        flex-shrink: 0;
        border-bottom: 1px solid var(--border-color);
    }

    .bottom-buttons {
        background-color: var(--bg-color);
        border-bottom: 1px solid var(--border-color);
        flex-shrink: 0;
    }

    /* 竖屏下拼音字母居中，字按钮固定最右边 */
    .pinyin-input-container {
        position: relative !important;
        justify-content: center !important;
    }
    .stroke-learn-btn {
        position: absolute !important;
        left: 8px !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
        margin-left: 0 !important;
    }
    
    .apple-keyboard {
        width: 100vw!important;
        flex-direction: column;
        gap: 0;
        background-color: var(--bg-color);
        border-top: none;
        margin: 0!important;
        z-index: 101;
        box-shadow: none!important;
        flex-shrink: 0;
    }
    
    .keyboard-main {
        padding-top: 2px !important;
        padding-bottom: env(safe-area-inset-bottom, 0)!important;
        gap: 8px;
    }

    .bottom-buttons .keyboard-nav-btn,.bottom-buttons .keyboard-func-btn,.bottom-buttons .keyboard-func-btn-alt,.bottom-buttons .keyboard-func-btn-secondary {
        width: calc(100vw / 9)!important;
        padding: 0;
        background: transparent!important;
        border: none!important;
        box-shadow: none!important;
        backdrop-filter: none!important;
        -webkit-backdrop-filter: none!important;
		margin: 0;
		font-size: 24px;
        font-weight: 500;
    }

    .bottom-buttons .keyboard-nav-btn img,.bottom-buttons .keyboard-func-btn img,.bottom-buttons .keyboard-func-btn-alt img,.bottom-buttons .keyboard-func-btn-secondary img {
        width: 24px!important;
        height: 24px!important;
    }

    .bottom-buttons .keyboard-btn-with-badge .number {
        position: absolute!important;
        top: -8px!important;
        left: 100%!important;
        transform: translateX(-50%)!important;
        font-size: 12px!important;
        min-width: 24px!important;
        line-height: 16px!important;
    }

    .writing-section {
        display: flex!important;
        flex-direction: column!important;
    }

    .sentence-section {
        order: 2!important;
    }

    .top-buttons {
        display: flex!important;
        flex-wrap: nowrap!important;
        overflow-x: auto!important;
        white-space: nowrap!important;
    }

    .top-buttons>div:nth-child(3),.top-buttons>div:nth-child(4),.top-buttons>div:nth-child(5) {
        display: flex!important;
    }

    .bottom-buttons #toggleImageBtnBottom{
        display: none!important;
    }

    .title-section {
        display: flex;
        align-items: center;
        font-family: var(--serif-font);
        font-weight: 500;
        /*font-size-adjust: 0.7; */
		padding-bottom:4px;
    }

    .title-section>div {
        display: inline-block;
    }

    .keyboard-left-buttons,.keyboard-right-buttons {
        display: none!important;
    }

    .keyboard-keys {
        width: 100%;
        gap: 0px!important;
        display: flex;
        flex-direction: column;
        justify-content: center;
        height: 100%;
        margin: 0;
        bottom: 10px;
        justify-content: end!important;
    }

    .keyboard-row {
        display: flex;
        flex-direction: row;
        justify-content: center;
        gap: 0px!important;
		margin: 1.5px 0;
    }

    .keyboard-letter-key {
        width: calc(100vw / 11);
        max-width: 10vw;
        height: 35px;
        font-size: 24px!important;
        padding: 12px 12px!important;
		margin: 0 2px;
    }

    .keyboard-backspace-key {
        width: calc(100vw / 13);
        min-width: 100px!important;
        height: 35px;
        padding: 12px 12px!important;
    }

    .keyboard-backspace-key-small {
        min-width: 60px!important;
        padding: 12px 6px!important;
        font-size: 12px!important;
    }

    #clearInputBtn {
        background-color: #FF9500 !important;
    }
    
    #clearInputBtn img {
        width: 24px !important;
        height: 24px !important;
        filter: brightness(0) invert(1) !important;
    }

    .keyboard-backspace-key img {
        width: 24px!important;
        height: 24px!important;
        filter: brightness(0) invert(1)!important;
    }

    .keyboard-func-btn,.keyboard-func-btn-alt,.keyboard-func-btn-secondary {
        width: 44px;
        height: 44px;
    }

    .keyboard-func-btn img,.keyboard-func-btn-alt img,.keyboard-func-btn-secondary img {
        width: 24px;
        height: 24px;
    }

    .keyboard-nav-btn {
        width: 44px;
        height: 44px;
    }

    .keyboard-nav-btn img {
        width: 24px;
        height: 24px;
    }

    .main-container>div:first-of-type>div:last-of-type {
        order: 3;
        width: 100%;
        display: flex;
        justify-content: center;
        padding-right: 0!important;
		padding-top: 10px;
    }

    .icon-btn {
        height: 34px!important;
        width: 34px!important;
    }

    .icon-btn img {
        width: 22px!important;
        height: 22px!important;
    }

    .icon-btn .number {
        font-size: 16px!important;
        padding: 3px 8px!important;
        top: auto!important;
        bottom: -8px!important;
        left: 50%!important;
        transform: translateX(-50%)!important;
    }

    .bottom-buttons .icon-btn .number {
        top: auto!important;
        bottom: -16px!important;
        left: 100%!important;
        min-width: 20px;
        line-height: 12px;
    }

    .top-buttons {
        margin-left: 0px!important;
        top:2px!important;
		justify-content: center;
		width: 100vw;
    }

    .top-buttons .top-btn {
        height: 28px!important;
        min-width: 10vw!important;
        max-width: 20vw;
        padding: 6px 4px!important;
        gap: 2px!important;
        margin-left: 0px!important;
    }

    .top-buttons .top-icon img {
        width: 18px!important;
        height: 18px!important;
        margin-right: 4px!important;
    }

    #mainTimerDisplay {
        font-size: 20px!important;
    }

    .top-buttons span {
        font-size: 14px!important;
    }

    .modal-content {
        width: 100vw!important;
        height: 85vh!important;
        max-height:600px !important;
        max-width: 550px !important;
        padding: 16px!important;
        padding-top: calc(20px + env(safe-area-inset-top, 0))!important;
        padding-bottom: calc(20px + env(safe-area-inset-bottom, 0))!important;
        box-sizing: border-box!important;
        z-index: 10000!important;
        pointer-events: auto!important;
    }

    .modal-content-flex {
        width: 95vw!important;
        height: 85vh!important;
        max-height: 85vh!important;
        padding: 16px!important;
        padding-top: calc(16px + env(safe-area-inset-top, 0))!important;
        padding-bottom: calc(16px + env(safe-area-inset-bottom, 0))!important;
        box-sizing: border-box!important;
        z-index: 10000!important;
        pointer-events: auto!important;
    }

    .modal-content-small {
        width: 90vw!important;
        height: auto!important;
        max-height: 85vh!important;
        padding: 20px!important;
    }

    .modal-content-medium {
        width: 100vw!important;
        height: auto!important;
        max-height: 85vh!important;
        overflow-y: auto!important;
        display: block!important;
    }

    .modal-content h3,.modal-content-flex h3 {
        font-size: 18px!important;
    }

    .modal-content table th,.modal-content-flex table th,.modal-content table td,.modal-content-flex table td {
        font-size: 14px!important;
        padding: 6px 8px!important;
    }

    .modal-content .btn,.modal-content-flex .btn {
        font-size: 14px!important;
        padding: 6px 12px!important;
        min-height: 0px!important;
        min-width: 0px!important;
        z-index: 10001!important;
        pointer-events: auto!important;
        position: relative!important;
    }

    .modal-content input,.modal-content select,.modal-content-flex input,.modal-content-flex select {
        font-size: 14px!important;
        padding: 8px!important;
        min-height: 36px!important;
    }

    #settingsModal .modal-content-small {
        width: 100vw!important;
        padding: 16px!important;
    }

    #settingsModal .space-y-6>div {
        display: flex!important;
        flex-direction: row!important;
        align-items: center!important;
        justify-content: space-between!important;
        flex-wrap: nowrap!important;
        white-space: nowrap!important;
    }

    #settingsModal label {
        font-size: 18px!important;
        width: auto!important;
        min-width: 100px!important;
        white-space: nowrap!important;
        margin-right: 16px!important;
        font-weight: bold!important;
    }

    #settingsModal select {
        font-size: 18px!important;
        padding: 10px!important;
        min-height: 0px!important;
        flex: 1!important;
        min-width: 0px!important;
    }

    #settingsModal input[type="number"] {
        font-size: 18px!important;
        padding: 10px!important;
        min-height: 0px!important;
    }

    #settingsModal .space-y-6>div:last-child {
        align-items: flex-center!important;
    }

    #settingsModal .space-y-6>div:last-child .flex-1 {
        flex: 1!important;
        min-width: 200px!important;
    }

    #settingsModal .color-btn {
        height: 36px!important;
    }

    #recordsModal .grid {
        grid-template-columns: repeat(2,1fr)!important;
        gap: 8px!important;
    }

    #recordsModal .grid>div {
        height: 70px!important;
        padding: 12px!important;
        display: flex!important;
        flex-direction: column!important;
        justify-content: center!important;
        align-items: center!important;
    }

    #recordsModal .text-2xl {
        font-size: 24px!important;
        font-weight: bold!important;
        line-height: 1.2!important;
        margin: 0!important;
    }

    #recordsModal .text-sm {
        font-size: 14px!important;
        font-weight: bold!important;
        line-height: 1.2!important;
        margin: 0!important;
        margin-bottom: 4px!important;
    }

    #clearOptionsModal .grid {
        grid-template-columns: repeat(2,1fr)!important;
        gap: 16px!important;
    }

    #clearOptionsModal input[type="checkbox"] {
        width: 24px!important;
        height: 24px!important;
    }

    #clearOptionsModal label {
        font-size: 18px!important;
        font-weight: bold!important;
    }

    #clearOptionsModal .text-red-600 {
        font-size: 18px!important;
        font-weight: bold!important;
    }

    #clearOptionsModal p {
        font-size: 18px!important;
        line-height: 1.4!important;
        font-weight: bold!important;
    }

    #clearOptionsModal .flex.items-center.gap-4.mb-6 {
        margin-bottom: 16px!important;
    }

    #clearOptionsModal .flex.items-center.gap-4.mb-6 input[type="checkbox"] {
        width: 24px!important;
        height: 24px!important;
    }

    #clearOptionsModal .flex.items-center.gap-4.mb-6 label {
        font-size: 18px!important;
        font-weight: bold!important;
    }

    #clearOptionsModal .grid>div {
        margin-bottom: 0!important;
    }

    #clearOptionsModal .btn {
        padding: 8px 16px!important;
        font-size: 16px!important;
        min-height: 40px!important;
        font-weight: bold!important;
    }

    #clear-options-confirm-btn,#switch-poem-confirm-btn {
        padding: 8px 16px!important;
        font-size: 16px!important;
        min-height: 40px!important;
        font-weight: bold!important;
    }

    #clear-options-cancel-btn,#switch-poem-cancel-btn {
        padding: 8px 16px!important;
        font-size: 16px!important;
        min-height: 40px!important;
        font-weight: bold!important;
    }

    #clearConfirmModal .btn,#importConfirmModal .btn,#deleteErrorConfirmModal .btn {
        padding: 6px 12px!important;
        font-size: 14px!important;
        min-height: 36px!important;
    }

    #clear-confirm-btn,#import-confirm-btn,#delete-error-confirm-btn {
        padding: 6px 12px!important;
        font-size: 14px!important;
        min-height: 36px!important;
		min-width: 60px;
    }

    #clear-confirm-cancel-btn,#import-confirm-cancel-btn,#delete-error-cancel-btn {
        padding: 6px 12px!important;
        font-size: 14px!important;
        min-height: 36px!important;
		min-width: 60px;
    }

    #clearConfirmModal p,#importConfirmModal p,#deleteErrorConfirmModal p {
        font-size: 18px!important;
        font-weight: bold!important;
        line-height: 1.4!important;		
    }

    #clearConfirmModal .text-red-600,#importConfirmModal .text-red-600,#deleteErrorConfirmModal .text-red-600 {
        font-size: 18px!important;
        font-weight: bold!important;
    }

    #clearConfirmModal h3,#importConfirmModal h3,#deleteErrorConfirmModal h3 {
        font-size: 24px!important;
        font-weight: bold!important;
    }

    #recordsModal .modal-content,#errorBookModal .modal-content {
        width: 100vw!important;
    }

    #recordsModal .table-container,#errorBookModal .table-container {
        width: 100%!important;
        overflow-x: hidden!important;
    }

    #recordsModal table,#errorBookModal table {
        width: 100%!important;
        table-layout: fixed!important;
    }

    #recordsModal table th,#recordsModal table td,#errorBookModal table th,#errorBookModal table td {
        font-size: 14px!important;
        padding: 4px 3px!important;
        word-wrap: break-word!important;
        overflow-wrap: break-word!important;
        font-weight: 700;
    }

    #recordsModal table th:first-child,#recordsModal table td:first-child,#errorBookModal table th:first-child,#errorBookModal table td:first-child {
        width: 30px!important;
        padding: 4px 2px!important;
    }

    #recordsModal table th:nth-child(2),#recordsModal table td:nth-child(2) {
        width: calc(100% - 180px)!important;
        flex: 1!important;
        min-width: 100px!important;
        text-align: left!important;
        padding: 4px 6px!important;
    }

    #errorBookModal table th:nth-child(2),#errorBookModal table td:nth-child(2) {
        width: 80px!important;
        flex: 1!important;
        min-width: 80px!important;
        text-align: left!important;
        padding: 4px 6px!important;
    }

    #recordsModal table th:nth-child(3),#recordsModal table td:nth-child(3),#recordsModal table th:nth-child(4),#recordsModal table td:nth-child(4),#recordsModal table th:nth-child(5),#recordsModal table td:nth-child(5),#recordsModal table th:nth-child(6),#recordsModal table td:nth-child(6),#recordsModal table th:nth-child(7),#recordsModal table td:nth-child(7) ,#recordsModal table th:nth-child(8),#recordsModal table td:nth-child(8){
        width: 36px!important;
        padding: 4px 2px!important;
        font-size: 14px!important;
    }

    #errorBookModal table th:nth-child(3),#errorBookModal table td:nth-child(3) {
        width: 34px!important;
        padding: 4px 2px!important;
        font-size: 14px!important;
    }

    #errorBookModal table th:nth-child(4),#errorBookModal table td:nth-child(4) {
        padding: 4px 6px!important;
        font-size: 14px!important;
    }

    #errorBookModal table th:nth-child(5),#errorBookModal table td:nth-child(5) {
        width: 55px!important;
        padding: 4px 2px!important;
        font-size: 14px!important;
    }

    .modal-content-medium p {
        font-size: 18px!important;
        line-height: 1.4!important;
    }

    .modal-content-medium h3 {
        font-size: 18px!important;
    }

    #imageModal .modal-content {
        width: 100vw!important;
        max-width: 100vw;
        padding: 0!important;
    }
    
    /* 图片弹窗支持缩放 */
    #imageModal {
        touch-action: auto!important;
        -webkit-user-select: auto!important;
        user-select: auto!important;
    }
    
    #imageModal img,
    #imageModal iframe {
        touch-action: auto!important;
        pointer-events: auto!important;
    }

    #positionSelectModal .modal-content {
        width: 95vw!important;
        height: 85vh!important;
    }

    #hintModal .modal-content {
        height: auto!important;
        font-size: 14px!important;
    }

    #hintModal .modal-content p {
        font-size: 14px!important;
        line-height: 1.4!important;
        margin: 4px 0!important;
    }

    #hintModal .modal-content h4 {
        font-size: 14px!important;
        margin-bottom: 6px!important;
        font-weight: bold!important;
    }

    #dictionaryModal .modal-content {
        height: auto!important;
        width: 90vw!important;
    }

    #hintContent {
        font-size: 14px!important;
        line-height: 1.4!important;
        padding: 10px!important;
		padding-bottom: 20px !important;
    }

    #hintContent p {
        font-size: 14px!important;
        line-height: 1.4!important;
        margin: 4px 0!important;
    }

    #hintContent h4 {
        font-size: 14px!important;
        margin-bottom: 6px!important;
        font-weight: bold!important;
    }

    .modal-content .btn-danger,.modal-content-flex .btn-danger {
        height: 36px!important;
        font-size: 14px!important;
        padding: 6px 12px!important;
        min-height: 36px!important;
        display: flex!important;
        align-items: center!important;
        justify-content: center!important;
        white-space: nowrap!important;
    }

    #settingsModal .btn-primary,#settingsModal .btn-danger {
        width: 60px!important;
        height: 36px!important;
        font-size: 14px!important;
        padding: 6px 12px!important;
        min-height: 36px!important;
        text-lg: none!important;
        px-6: none!important;
        py-3: none!important;
    }

    #importModal .modal-content {
        width: 100vw!important;
        height: 85vh!important;
        max-height: 85vh!important;
    }

    #importModal .table-container {
        width: 100%!important;
        overflow-x: hidden!important;
    }

    #importModal table {
        width: 100%!important;
        table-layout: fixed!important;
    }

    #importModal table th,#importModal table td {
        word-wrap: break-word!important;
        overflow-wrap: break-word!important;
        text-align: left!important;
        font-size: 14px!important;
        padding: 6px 8px!important;
    }

    #importModal table th:first-child,#importModal table td:first-child {
        width: 50px!important;
        text-align: center!important;
        padding: 4px 2px!important;
    }

    #importModal table th:nth-child(2),#importModal table td:nth-child(2) {
        flex: 1!important;
        width: calc(100% - 120px)!important;
        padding: 4px 6px!important;
    }

    #importModal table th:last-child,#importModal table td:last-child {
        width: 70px!important;
        text-align: center!important;
        padding: 4px 2px!important;
    }

    #importModal table .btn-danger-sm,#errorBookModal table .btn-danger-sm {
        width: 50px!important;
        height: 28px!important;
        font-size: 14px!important;
        padding: 4px 8px!important;
        min-height: 28px!important;
        margin: 0 auto!important;
        display: block!important;
        text-align: center!important;
    }

    table .btn-danger-sm {
        width: 50px!important;
        height: 28px!important;
        font-size: 14px!important;
        padding: 4px 8px!important;
        min-height: 28px!important;
        margin: 0 auto!important;
        display: block!important;
        text-align: center!important;
        border-radius: var(--radius-sm)!important;
        background-color: var(--error-color)!important;
        color: white!important;
        border: none!important;
        cursor: pointer!important;
        transition: all var(--transition-fast)!important;
    }

    table .btn-danger-sm:hover {
        background-color: var(--error-hover)!important;
        transform: translateY(-1px)!important;
    }

    table .btn-danger-sm:active {
        transform: translateY(0)!important;
    }

    #importModal table th,#importModal table td {
        padding: 4px 3px!important;
        font-size: 16px!important;
        font-weight: 700;
    }

    .completion-modal-content{
        width: 80vw !important;
        height: auto !important;
		padding-bottom: 30px !important;
    }

    .completion-modal-content #completionNextBtn {
        width: 90%;
        font-size: 20px !important;
        padding: 8px 12px !important;
    }
	.completion-modal-content #completionHintBtn {
        width: 90%;
        font-size: 20px !important;
        padding: 8px 12px !important;
    }
}
@media (min-aspect-ratio:1/1) {
    :root {
        font-size: var(--base-font-size)!important;
    }

    #handwritingModalContent {
        max-width: 550px !important;
    }

    #dictionaryModal .modal-content {
        width: 50vw!important;
        max-width: 500px!important;
    }

    #clearConfirmModal p,#importConfirmModal p,#deleteErrorConfirmModal p {
        font-size: 20px!important;
        font-weight: bold!important;
        line-height: 1.4!important;
    }

    #clearConfirmModal .text-red-600,#importConfirmModal .text-red-600,#deleteErrorConfirmModal .text-red-600 {
        font-size: 20px!important;
        font-weight: bold!important;
    }

    #clearConfirmModal h3,#importConfirmModal h3,#deleteErrorConfirmModal h3 {
        font-size: 26px!important;
        font-weight: bold!important;
    }

    /* 横屏模式下的导入确认弹窗 - 18px */
    #importConfirmModalContent,
    #importConfirmTable,
    #importConfirmTable th,
    #importConfirmTable td {
        font-size: 18px !important;
    }

    .main-container {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: flex-start;
        justify-content: center;
        padding-top: 0px!important;
        min-height: 100dvh;
        max-height: 100dvh;
        overflow: hidden;
        position: relative;
    }

    .top-buttons {
        width: 100%;
        margin-bottom: 20px;
    }

    .content-wrapper {
        flex-direction: row!important;
        align-items: stretch!important;
    }
    
    .image-section {
        width: 30vw!important;
        margin-bottom: 0;
        max-height: none;
        align-items: flex-start;
        flex: 0 0 auto!important;
    }
    
    .image-section>div:first-child>div:nth-child(2) {
        display: none;
    }
    
    .image-section>div:nth-child(2) {
        display: block!important;
    }
    
    .content-wrapper > div:nth-child(2) {
        flex: 1!important;
    }
    
    .content-section,
    .writing-section {
        width: auto!important;
        overflow-y: auto;
        font-family: var(--serif-font);
/*        font-size-adjust: 0.6;*/
    }

    .title-section {
        font-family: var(--serif-font);
        font-weight: 500;
/*        font-size-adjust: 0.7;*/
    }

    .bottom-buttons {
        position: absolute;
        bottom: calc(80px + env(safe-area-inset-bottom, 0));
        left: 0;
        width: 100%!important;
        display: none!important;
        justify-content: center!important;
        flex-wrap: wrap!important;
        margin: 0!important;
        z-index: 100;
        padding: 10px 0;
    }

    .bottom-buttons .keyboard-nav-btn img,.bottom-buttons .keyboard-func-btn img,.bottom-buttons .keyboard-func-btn-alt img,.bottom-buttons .keyboard-func-btn-secondary img {
        width: 32px!important;
        height: 32px!important;
    }

    .bottom-buttons .keyboard-btn-with-badge .number {
        position: absolute!important;
        left: 100%!important;
        transform: translateX(-50%)!important;
        font-size: 16px!important;
        min-width: 40px!important;
        line-height: 16px!important;
        bottom: -10px;
        top: auto;
    }

    .control-buttons {
        width: 100%;
        justify-content: center;
    }

    .hint-section {
        width: 100%;
        margin-bottom: 60px;
    }

    .apple-keyboard {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 20px;
        width: 100%;
        box-sizing: border-box;
        flex-shrink: 0;
    }
    
    .keyboard-main {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 20px;
		padding: 5px!important;
        box-sizing: border-box;
        flex: 1;
		z-index: 999;
    }

    .keyboard-left-buttons,.keyboard-right-buttons {
        display: flex!important;
    }

    .keyboard-keys {
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: center;
        height: 100%;
        margin: 0;
    }

    .keyboard-row {
        display: flex;
        flex-direction: row;
        justify-content: center;
        gap: 8px;
        height: 56px;
    }

    .keyboard-letter-key {
        width: calc(100vw / 20);
        max-width: 70px;
        height: 56px;
        font-size: 24px;
    }

    .keyboard-backspace-key {
        min-width: 100px;
        height: 56px;
    }

    .keyboard-func-btn,.keyboard-func-btn-alt,.keyboard-func-btn-secondary {
        width: calc(100vw / 20);
        max-width: 70px;
        height: 56px;
    }

    .keyboard-nav-btn {
        width: calc(100vw / 20);
        max-width: 70px;
        height: 56px;
    }

    .keyboard-func-btn img,.keyboard-func-btn-alt img,.keyboard-func-btn-secondary img {
        width: 28px;
        height: 28px;
    }

    .keyboard-nav-btn img {
        width: 28px;
        height: 28px;
    }
}

.pinyin-input-container {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 0 8px;
    min-height: 50px;
    height: 50px;
    overflow: hidden;
}

/* 提示文字滚动动画 */
.pinyin-input-container .scroll-hint {
    white-space: nowrap;
    overflow: hidden;
    display: inline-block;
    max-width:50vw;
	margin-left: 30px;
}

.pinyin-input-container .scroll-hint span {
    display: inline-block;
    animation: scrollLeft 14s linear infinite;
    padding-left: 100%;
}

@keyframes scrollLeft {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-100%);
    }
}

/* 学字按钮 */
.stroke-learn-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    height: 36px;
    border-radius: 8px;
    border: none;
    background-color:#ff6c00;
    color: #ffffff;
    font-size: 18px;
    font-weight: 500;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s ease;
    padding: 0 8px;
	margin-right: 30px;
}

.stroke-learn-btn:active {
    transform: scale(0.95);
}

/* 学字弹窗 */
.stroke-learn-modal-content {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    background-color: var(--bg-color) !important;
    border-radius: 12px !important;
    padding: 20px !important;
    width: auto !important;
    height: auto !important;
    overflow: visible !important;
    position: relative !important;
}

.stroke-mode-buttons {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    justify-content: flex-end;
    width: 100%;
}

.stroke-mode-btn {
    padding: 5px 16px;
    border: 2px solid;
    border-radius: 20px;
    background: transparent;
    color: var(--text-color);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.stroke-mode-btn[data-mode="watch"] {
    border-color: var(--success-color);
    color: var(--success-color);
}
.stroke-mode-btn[data-mode="follow"] {
    border-color: var(--primary-color);
    color: var(--primary-color);
}
.stroke-mode-btn[data-mode="quiz"] {
    border-color: #f97316;
    color: #f97316;
}

.stroke-mode-btn.active {
    color: #fff !important;
}
.stroke-mode-btn[data-mode="watch"].active {
    background: var(--success-color);
}
.stroke-mode-btn[data-mode="follow"].active {
    background: var(--primary-color);
}
.stroke-mode-btn[data-mode="quiz"].active {
    background: #f97316;
}

.stroke-reset-btn {
    border-color: var(--error-color) !important;
    color: var(--error-color) !important;
}
@media (hover: hover) {
    .stroke-reset-btn:hover {
        background: var(--error-color) !important;
        color: #fff !important;
    }
}
.stroke-reset-btn:active {
    background: var(--error-color) !important;
    color: #fff !important;
}

.hanzi-grid-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hanzi-mige {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

#hanziWriterTarget {
    position: relative;
    z-index: 2;
}

/* 隐藏HanziWriter内部网格，只用SVG米字格 */
#hanziWriterTarget svg line[stroke-dasharray],
#hanziWriterTarget svg rect[stroke-dasharray] {
    display: none !important;
}

/* 搜索框滚动提示 */
.search-input-wrapper {
    position: relative;
    flex: 1;
	margin-left: -13px;
}

.search-input-wrapper input {
    width: 100%;
}

.search-scroll-placeholder {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    color: #999;
    pointer-events: none;
    white-space: nowrap;
    overflow: hidden;
    width: calc(100% - 20px);
}

.search-scroll-placeholder span {
    display: inline-block;
    animation: searchScrollLeft 20s linear infinite;
    padding-left: 100%;
}

@keyframes searchScrollLeft {
    0% { transform: translateX(0); }
    100% { transform: translateX(-100%); }
}
#handwritingGridContainer #handwritingCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
}

#handwritingGridContainer {
    transition: opacity 0.15s ease;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,0.1);
}
.dark #handwritingGridContainer {
    background: #2a2a2a;
    box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}
.dark #handwritingGridContainer .hanzi-mige line,
.dark #handwritingGridContainer .hanzi-mige rect {
    stroke: #555;
}

.handwriting-result-btn {
    width: 44px;
    height: 44px;
    font-size: 24px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-color);
    color: var(--text-color);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}
.handwriting-result-btn:hover {
    border-color: var(--success-color);
    background: var(--success-color);
    color: #fff;
}

.stroke-learn-modal-content #hanziWriterTarget {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.pinyin-word-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap:10px;
    margin: 0 5px;
	padding-left: 20px;
}

.pinyin-char-box {
    width: 32px;
    height: 42px;
    line-height: 42px;
    text-align: center;
    font-size: 36px;
    background: transparent;
    padding: 0;
    outline: none;
    flex-shrink: 0;
    display: inline-flex;
    align-items: end;
    justify-content: center;
    font-weight: 500;
    font-family: -apple-system,BlinkMacSystemFont,"SF Pro Display","Segoe UI",Roboto,sans-serif;
    color: var(--text-color);
    border-bottom: 2px solid #c4c4c4;
    border-radius: 0;
    box-sizing: border-box;
    vertical-align: middle;
}

.pinyin-char-box[type="text"] {
    width: 36px;
    height: 50px;
    line-height: 50px;
    text-align: center;
    font-size: 24px;
    background: transparent;
    padding: 0;
    outline: none;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    font-family: -apple-system,BlinkMacSystemFont,"SF Pro Display","Segoe UI",Roboto,sans-serif;
    color: var(--text-color);
    border: none;
    border-bottom: 2px solid #c4c4c4;
    border-radius: 0;
    box-sizing: border-box;
    vertical-align: middle;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.pinyin-char-box.active {
    border-bottom-color: var(--primary-color);
}

.pinyin-char-box.active-animation {
    outline: none;
    border: 1px solid var(--primary-color) !important;
    box-shadow: 0 0 0 3px rgb(0 122 255 / .2) !important;
    transform: translateY(-1px) !important;
    background: rgb(0 122 255 / .05) !important;
    transition: all 0.3s cubic-bezier(.4,0,.2,1);
}

.pinyin-char-box:focus {
    outline: none;
    border-bottom: 2px solid var(--primary-color) !important;
/*    box-shadow: 0 0 0 3px rgb(0 122 255 / .2) !important;
    transform: translateY(-1px) !important;*/
    background: rgb(0 122 255 / .15);
    transition: all 0s;
}

.pinyin-char-box.correct {
    border-bottom-color: var(--success-color)!important;
    color: var(--success-color)!important;
}

.pinyin-char-box.incorrect {
    border-bottom-color: var(--error-color)!important;
    color: var(--error-color)!important;
}

.menu-toggle {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 1000;
    background-color: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 8px 12px;
    cursor: pointer;
}

#answerDisplayArea {
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-color);
    max-height: 80px;
    padding: 6px;
    border-radius: 4px;
    background-color: rgb(59 130 246 / .08);
    word-wrap: break-word;
    line-height: 1.5;
    overflow-y: auto;
    visibility: hidden;
    opacity: 0;
    transition: visibility 0s,opacity 0.3s ease;
    position: fixed;
    right: 0;
    z-index: 5;
    box-sizing: border-box;
}

#answerDisplayArea.show {
    visibility: visible;
    opacity: 1;
}

.space-placeholder {
    width: 15.6px;
    margin: 0 7.8px;
    border-bottom: none;
    flex-shrink: 0;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal.show {
    display: flex;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.7);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 0 10px rgba(255, 59, 48, 0);
    }
}

.import-btn.highlight {
    animation: pulse 1.5s infinite;
    background: #FF3B30 !important;
}

.import-btn.highlight img {
    filter: brightness(0) invert(1) !important;
}

.import-hint {
    position: absolute;
    top: -40px;
    left: -12px;
    right: -12px;
    bottom: 12px;
    pointer-events: none;
    z-index: 2000;
}

.hint-text {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    font-size: 20px;
    font-weight: bold;
    color: #FF3B30;
    white-space: nowrap;
    animation: textBounce 0.8s infinite ease-in-out;
}

/* 竖屏模式下的引导指示样式 */
.hint-text.portrait {
    font-size: 14px;
}

.hint-dashed-border.portrait {
    display: none;
}

@keyframes textBounce {
    0%, 100% {
        transform: translateX(-50%) translateY(0);
    }
    50% {
        transform: translateX(-50%) translateY(-5px);
    }
}

.hint-dashed-border {
    display: none;
}

@keyframes borderPulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(1.05);
    }
}

@keyframes pinyinFlash {
    0%, 100% {
        opacity: 1;
		background: transparent;
    }
    50% {
        opacity: 1;
		background: transparent;
    }
}

.pinyin-char-box.flash {
    animation: pinyinFlash 0.5s infinite;
}

@keyframes hwSpin {
    to { transform: rotate(360deg); }
}

.modal-content {
    animation: fadeIn 0.3s ease;
}

.modal-content,.modal-content-flex {
    font-weight: 700;
}

.modal-content .btn,.modal-content-flex .btn {
    font-weight: 700;
}

.modal-content table th,.modal-content-flex table th {
    font-weight: 700;
    font-size: 18px!important;
}

.modal-content table td,.modal-content-flex table td {
    font-weight: 700;
    font-size: 18px!important;
}

.modal-content input,.modal-content select,.modal-content-flex input,.modal-content-flex select {
    font-weight: 700;
}

.apple-keyboard {
    width: 100%;
    background-color: var(--bg-color);
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 0;
    box-shadow: 0 -2px 10px rgb(0 0 0 / .05);
    z-index: 999;
    transition: opacity 0.5s ease-out;
    opacity: 1;
}

.apple-keyboard.hidden {
    opacity: 0;
}

.keyboard-left-buttons,.keyboard-right-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 20vw;
    height: 100%;
    justify-content: center;
}

.keyboard-left-buttons {
    align-items: flex-end;
}

.keyboard-right-buttons {
    align-items: flex-start;
}

.keyboard-btn-row {
    display: flex;
    gap: 30px;
    justify-content: center;
    align-items: center;
    height: 56px;
}

.keyboard-btn-with-badge {
    position: relative;
    display: inline-block;
}

.keyboard-btn-with-badge .number {
    left: 100%;
    position: absolute;
    transform: translateX(-50%);
    font-size: 14px;
    font-weight: 700;
    min-width: 40px;
    text-align: center;
    line-height: 16px;
    z-index: 10;
    top: -10px;
}

.keyboard-keys {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
    height: 100%;
}

.keyboard-row {
    display: flex;
    justify-content: center;
    gap: 4px;
}

/* 字母按键（原始） */
.keyboard-letter-key {
    padding: 0 !important;
    background-color: #fff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    font-size: 28px;
    font-weight: 500;
    text-align: center;
    box-shadow: 0 2px 4px rgb(0 0 0 / .05);
    transition: all 0s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.keyboard-letter-key:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgb(0 0 0 / .1);
}

.keyboard-letter-key:active {
    transform: scale(.95) translateY(0);
    box-shadow: inset 0 2px 4px rgb(0 0 0 / .15);
    background-color: #f0f0f0;
}

/* 退格键（原始） */
.keyboard-backspace-key {
    padding: 16px 24px;
    background-color: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    min-width: 112px;
    text-align: center;
    box-shadow: 0 2px 4px rgb(0 122 255 / .2);
    transition: all 0s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.keyboard-backspace-key:hover {
    background-color: #06c;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgb(0 122 255 / .3);
}

.keyboard-backspace-key:active {
    transform: scale(.95) translateY(0);
    box-shadow: inset 0 2px 4px rgb(0 122 255 / .3);
    background-color: #05a;
}

.keyboard-backspace-key img {
    width: 36px;
    height: 36px;
    filter: brightness(0) invert(1);
}

.keyboard-backspace-key-small {
    min-width: 70px;
    padding: 16px 12px;
    font-size: 14px;
}

/* 清空按钮（原始） */
#clearInputBtn {
    background: #ff6c00 !important;
}
#clearInputBtn img {
    width: 30px;
    height:30px;
	max-width: unset;
    filter: brightness(0) invert(1);
}

/* 导航按钮（原始） */
.keyboard-nav-btn {
    padding: 8px;
    background-color: var(--glass-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    font-size: 16px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgb(0 0 0 / .05);
    transition: all 0s;
}

.keyboard-nav-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgb(0 0 0 / .1);
}

.keyboard-nav-btn:active {
    transform: scale(.95) translateY(0);
    box-shadow: inset 0 2px 4px rgb(0 0 0 / .15);
    background-color: rgb(0 0 0 / .05);
}

/* 功能按钮（原始） */
.keyboard-func-btn,.keyboard-func-btn-alt,.keyboard-func-btn-secondary {
    padding: 8px;
    background-color: var(--glass-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgb(0 0 0 / .05);
    transition: all 0s;
}

.keyboard-func-btn:hover,.keyboard-func-btn-alt:hover,.keyboard-func-btn-secondary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgb(0 0 0 / .1);
}

.keyboard-func-btn:active,.keyboard-func-btn-alt:active,.keyboard-func-btn-secondary:active {
    transform: scale(.95) translateY(0);
    box-shadow: inset 0 2px 4px rgb(0 0 0 / .15);
    background-color: rgb(0 0 0 / .05);
}

.keyboard-func-btn img,.keyboard-func-btn-alt img,.keyboard-func-btn-secondary img {
    width: 32px;
    height: 32px;
}

.keyboard-nav-btn img {
    width: 32px;
    height: 32px;
}

.keyboard-nav-btn #toggleInputModeText {
    font-size: 30px;
    font-weight: bold;
    color: #434b4b;
    pointer-events: none;
}

/* 暗色模式下键盘样式（原始） */
.dark .keyboard-letter-key {
    background-color: #1e293b;
    border-color: rgb(255 255 255 / .2);
    color: #fff;
}

.dark .keyboard-backspace-key {
    background-color: var(--primary-color);
    color: #fff;
}

.dark .keyboard-nav-btn {
    background-color: #0f172a;
    border-color: rgb(255 255 255 / .2);
    color: #fff;
}

.dark .keyboard-func-btn,.dark .keyboard-func-btn-alt,.dark .keyboard-func-btn-secondary {
    background-color: #0f172a;
    border-color: rgb(255 255 255 / .2);
    color: #fff;
}

/* 图片弹窗样式 - 最高层级 */
#imageModal {
    z-index: 99999 !important;
}

/* 下载弹窗样式 */
#downloadModal {
    z-index: 99999 !important;
}

#downloadModal .modal-content {
    height: auto !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
	width: 400px;
}

#downloadModal h3 {
    font-size: 18px !important;
    font-weight: bold !important;
    margin-bottom: 16px !important;
    text-align: center !important;
    color: var(--text-color) !important;
}

#downloadModal p {
    margin-bottom: 16px !important;
    text-align: center !important;
    color: var(--text-color) !important;
}

#downloadModal .download-btn {
    background-color: #10b981 !important;
    color: white !important;
    font-weight: 500 !important;
    padding: 12px !important;
    width: 100% !important;
    text-align: center !important;
    border-radius: 4px !important;
    margin-bottom: 12px !important;
    transition: background-color 0.2s ease !important;
}

#downloadModal .download-btn:hover {
    background-color: #10b981 !important;
}

#downloadModal .cancel-btn {
    background-color: #f97316 !important;
    color: white !important;
    padding: 12px !important;
    width: 100% !important;
    text-align: center !important;
    border-radius: 4px !important;
    transition: background-color 0.2s ease !important;
    border: 1px solid #f97316 !important;
}

#downloadModal .cancel-btn:hover {
    background-color: #ea580c !important;
    color: white !important;
}

#downloadModal .ios-tip {
    margin-top: 16px !important;
    font-size: 14px !important;
    opacity: 0.75 !important;
    text-align: center !important;
    color: var(--text-color) !important;
}

/* 暗色模式 active 状态（原始） */
.dark .keyboard-letter-key:active {
    background-color: #2a3546;
    box-shadow: inset 0 2px 4px rgb(0 0 0 / .3);
}

.dark .keyboard-backspace-key:active {
    background-color: #05a;
    box-shadow: inset 0 2px 4px rgb(0 122 255 / .4);
}

.dark .keyboard-nav-btn:active {
    background-color: #1a2332;
    box-shadow: inset 0 2px 4px rgb(0 0 0 / .3);
}

.dark .keyboard-func-btn:active,.dark .keyboard-func-btn-alt:active,.dark .keyboard-func-btn-secondary:active {
    background-color: #1a2332;
    box-shadow: inset 0 2px 4px rgb(0 0 0 / .3);
}

.dark .apple-keyboard {
    background-color: var(--bg-color);
    border-top-color: rgb(255 255 255 / .1);
    box-shadow: 0 -2px 10px rgb(0 0 0 / .2);
}

/* 暗色模式功能按钮（原始） */
.dark .keyboard-func-btn {
    border-color: rgb(255 255 255 / .2);
    color: #fff;
}

.dark .keyboard-func-btn-alt {
    background-color: #0f172a;
    border-color: rgb(255 255 255 / .2);
    color: #fff;
}

.dark .keyboard-func-btn-secondary {
    background-color: #0f172a;
    border-color: rgb(255 255 255 / .2);
    color: #fff;
}

/* 暗色模式下按钮图标反转为白色 */
.dark .keyboard-nav-btn img,
.dark .keyboard-func-btn img,
.dark .keyboard-func-btn-alt img,
.dark .keyboard-func-btn-secondary img {
    filter: brightness(0) invert(1);
}

a {
    color: #00913b!important;
    ;text-decoration: underline;
    font-weight: 700;
    transition: all 0.2s ease;
}

a:hover {
    color: #0056b3;
    text-decoration: none;
}

.dark a {
    color: #007AFF;
}

.dark a:hover {
    color: #34C759;
}