        @font-face {
            font-family: 'ALKATIP Basma';
            src: url('/fonts/alkatip-basma-v6.ttf') format('truetype');
            font-style: normal;
            font-weight: 400;
            font-display: swap;
            unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF;
        }
        @font-face {
            font-family: 'UKIJ Tuz';
            src: url('/fonts/ukij-tuz-v1.ttf') format('truetype');
            font-style: normal; font-weight: 400; font-display: swap;
            unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF;
        }
        @font-face {
            font-family: 'UKIJ Tuz Tom';
            src: url('/fonts/ukij-tuz-tom-v1.ttf') format('truetype');
            font-style: normal; font-weight: 400; font-display: swap;
            unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF;
        }
        @font-face {
            font-family: 'Noto Naskh Arabic';
            src: url('/fonts/noto-naskh-arabic-v1.ttf') format('truetype');
            font-style: normal; font-weight: 400 700; font-display: swap;
            unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF;
        }
        /* --- 1. 现代 & 专业 Color Palette --- */
        :root {
            --bg-color: #f1f5ff;            /* 页面背景 */
            --surface-color: #ffffff;       /* 面板颜色，纯白卡片 */
            --primary-color: #2563eb;        /* 主色调 */
            --primary-hover-color: #1d4ed8;  /* 主色调悬停时加深 */
            --text-color-primary: #151922;   /* 主要文字颜色，深灰色 */
            --text-color-secondary: #687182; /* 次要文字，中度灰色 */
            --border-color: #e3e8ef;        /* 面板边框 */
            --shadow: none;
            --focus-glow: 0 0 0 2px rgba(37, 99, 235, 0.12); /* 焦点光晕效果 */
        }

        /* --- 2. 基础 & 布局优化 --- */
        * { margin: 0; padding: 0; box-sizing: border-box; }
        html { font-size: 93.75%; scroll-behavior: smooth; scrollbar-gutter: stable; }
        body {
            font-family: var(--uyghur-font, 'ALKATIP Basma'), -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
            background-color: var(--bg-color);
            background-image: radial-gradient(ellipse at 8% 0%, rgba(167, 139, 250, 0.13), transparent 55%), radial-gradient(ellipse at 100% 100%, rgba(56, 189, 248, 0.1), transparent 55%);
            background-attachment: fixed;
            min-height: 100vh;
            min-height: 100dvh;
            color: var(--text-color-primary);
            line-height: 1.6;
            -webkit-font-smoothing: antialiased; /* 字体渲染优化 */
            -moz-osx-font-smoothing: grayscale;
        }
        .container {
            max-width: 1360px;
            margin: 0 auto;
            padding: 1.25rem max(1.25rem, env(safe-area-inset-right)) max(1.25rem, env(safe-area-inset-bottom)) max(1.25rem, env(safe-area-inset-left));
        }
        .pointer-light { position: fixed; inset: 0; overflow: hidden; z-index: 2000; pointer-events: none; opacity: 0; transition: opacity 220ms ease; }
        .pointer-light::before {
            content: ""; position: absolute; top: 0; left: 0; width: 360px; height: 360px;
            background: radial-gradient(circle, rgba(76, 111, 235, 0.085), transparent 70%);
            transform: translate3d(calc(var(--light-x, 0px) - 180px), calc(var(--light-y, 0px) - 180px), 0);
            will-change: transform;
        }
        @media (hover: none), (pointer: coarse), (prefers-reduced-motion: reduce) {
            .pointer-light { display: none; }
        }
        
        /* --- 专业的页眉 --- */
        .site-header {
            display: flex;
            flex-wrap: wrap;
            justify-content: space-between;
            align-items: center;
            gap: 0.75rem;
            margin-bottom: 0.75rem;
            padding: 0.625rem 1rem;
            background: var(--surface-color);
            border: 1px solid var(--border-color);
            border-radius: 6px;
        }
        .site-header .logo {
            font-size: 1.25rem;
            font-weight: 700;
            color: var(--primary-color);
            text-decoration: none;
            white-space: nowrap;
        }
        .site-header .logo span {
            color: var(--text-color-primary);
            font-weight: 500;
        }
        .account-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 0.375rem; min-width: 0; max-width: 100%; }
        .account-summary { color: var(--text-color-secondary); font-size: 0.8125rem; overflow-wrap: anywhere; }
        .account-summary:empty { display: none; }
        a.account-summary { text-decoration: none; padding: 0.25rem 0; }
        a.account-summary:hover { color: var(--primary-color); text-decoration: underline; text-underline-offset: 3px; }
        .profile-page .dashboard-grid, .profile-page .mobile-notice { display: none; }
        .profile-panel { max-width: 760px; margin: 1.5rem auto 0; padding: clamp(1rem, 4vw, 1.75rem); border: 1px solid var(--border-color); border-radius: 8px; background: var(--surface-color); }
        .profile-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1rem; }
        .profile-heading h1 { font-size: 1.375rem; font-weight: 600; }
        .profile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 0; }
        .profile-grid > div { min-width: 0; padding: 0.875rem 0; border-top: 1px solid var(--border-color); }
        .profile-grid dt { color: var(--text-color-secondary); font-size: 0.8125rem; margin-bottom: 0.25rem; }
        .profile-grid dd { font-size: 0.9375rem; overflow-wrap: anywhere; padding-right: 1rem; }
        .profile-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }
        .account-button {
            min-height: 34px; padding: 0.375rem 0.625rem; border: 1px solid transparent;
            border-radius: 7px; background: transparent; color: #526078;
            font: inherit; font-size: 0.8125rem; line-height: 1.4; cursor: pointer;
        }
        .account-button:hover { background: #eef3fb; color: var(--primary-color); }
        a.account-button { text-decoration: none; }
        #admin-link[hidden] { display: none; }
        .account-button.primary { background: var(--primary-color); border-color: var(--primary-color); color: white; }
        .account-button.primary:hover { background: var(--primary-hover-color); }
        .account-button:disabled { opacity: 0.6; cursor: wait; }
        .site-header .account-button.primary { background: #edf3ff; border-color: var(--soft-button-border); color: #2456bd; }
        .site-header .account-button.primary:hover { background: #e0eaff; }
        .community-actions { display: inline-flex; align-items: center; gap: 0.375rem; flex-shrink: 0; }
        .online-button { display: inline-flex; align-items: center; gap: 0.375rem; }
        .chat-entry-button { display: inline-flex; align-items: center; justify-content: center; gap: 0.375rem; border-color: var(--soft-button-border); background: #edf3ff; color: #2456bd; font-weight: 500; }
        .chat-entry-button:hover { background: #e0eaff; }
        .chat-entry-button svg { width: 16px; height: 16px; flex-shrink: 0; }
        .online-dot { width: 7px; height: 7px; border-radius: 50%; background: #22a06b; flex-shrink: 0; }
        .mobile-notice { display: none; }
        .mobile-notice[hidden] { display: none; }
        html[data-mobile-notice-dismissed] .mobile-notice { display: none; }

        .font-preferences { grid-column: 1 / -1; display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 0.375rem 0.5rem; margin-top: -0.375rem; color: var(--text-color-secondary); font-size: 0.8125rem; }
        .font-preferences label { white-space: nowrap; }
        .font-preferences select { max-width: 100%; min-height: 32px; width: 175px; padding: 0.25rem 0.5rem; border: 1px solid #e3e9f2; border-radius: 6px; background: #f8faff; color: #46556d; font: inherit; cursor: pointer; }
        .font-preferences select:hover { background: #f0f5ff; border-color: #c5d5ed; }
        .font-preferences select:focus-visible { outline: 2px solid #96b5ef; outline-offset: 2px; }
        .font-preferences select:disabled { cursor: wait; opacity: 0.65; }
        .font-preference-status:empty { display: none; }
        .font-preference-status { color: #b42318; font-size: 0.75rem; }


.site-sections { display: flex; gap: 6px; align-items: center; margin: 0 0 18px; padding: 4px; width: max-content; max-width: 100%; border: 1px solid var(--border-color); border-radius: 9px; background: var(--surface-color); }
.site-sections a { padding: 7px 17px; color: var(--text-color-secondary); text-decoration: none; font-size: 13px; font-weight: 600; border-radius: 6px; white-space: nowrap; transition: background .15s, color .15s; }
.site-sections a:hover, .site-sections a[aria-current=page] { background: #eef2ff; color: var(--primary-color); }
.profile-page .site-sections a[aria-current] { background: transparent; color: var(--text-color-secondary); }
.profile-videos{margin-top:24px;border-top:1px solid var(--border-color);padding-top:20px}.profile-videos h2{font-size:16px;font-weight:600}.profile-video-row{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:13px 0;border-bottom:1px solid var(--border-color);font-size:13px}.profile-video-row>div{min-width:0}.profile-video-row strong{display:block;font-weight:500;overflow-wrap:anywhere}.profile-video-row small{display:block;color:var(--text-color-secondary);margin-top:4px}.profile-video-row a{color:var(--primary-color);white-space:nowrap;text-decoration:none}@media(max-width:600px){.site-sections{margin-bottom:12px}.site-sections a{font-size:12px;padding:7px 14px}.profile-video-row{align-items:flex-start}}

/* Shared component dimensions are authoritative on both pages. */
:root { --panel-radius: 8px; --button-radius: 8px; --blue: var(--primary-color); --blue-dark: var(--primary-hover-color); --line: var(--border-color); --muted: var(--text-color-secondary); }
:root { --soft-button-border: #c4d6fb; }
.site-header :is(#auth-btn, #mt-login),
.site-footer .account-button[data-feedback-open] {
 border-color: var(--soft-button-border); background: #f8faff; color: #2456bd;
}
/* Inset outlines keep the existing padding and hit areas. */
.panel-actions :is(#speech-open, #ocr-open, #copy-btn),
body[data-integrated] :is(.editor-toolbar #save, .subtitle-position .button) {
 box-shadow: inset 0 0 0 1px var(--soft-button-border);
}
.panel-actions :is(#speech-open, #ocr-open, #copy-btn) {
 background: #f8faff; color: #2456bd;
}
.site-header :is(#auth-btn, #mt-login):hover:not(:disabled),
.site-footer .account-button[data-feedback-open]:hover,
.panel-actions :is(#speech-open, #ocr-open, #copy-btn):hover,
body[data-integrated] .editor-toolbar #save:hover:not(:disabled) {
 background: #eaf1ff;
}
.site-header .account-button { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; line-height: 1.4; }
.site-header .account-summary { display: inline; }
.site-header .account-summary:empty, .site-header .account-summary[hidden], .site-header .account-button[hidden] { display: none; }
.site-header .online-button { font-variant-numeric: tabular-nums; }
.site-header .online-button span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-footer { display: block; text-align: center; margin-top: 1.25rem; padding: 1rem 0 0; border-top: 1px solid var(--border-color); color: var(--text-color-secondary); font-size: .75rem; line-height: 1.6; }
.account-button { transition: background-color 160ms ease, color 160ms ease, box-shadow 160ms ease, transform 120ms ease; }
.account-button:active:not(:disabled) { transform: scale(.97); }
:is(button, a.account-button):focus-visible { outline: 2px solid #709deb; outline-offset: 3px; }
@media (max-width: 959px) {
 .site-header { align-items: flex-start; flex-direction: column; gap: .5rem; }
 .account-actions { width: 100%; justify-content: flex-start; }
}
@media (max-width: 759px) {
 .container { padding: 1rem max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left)); }
}
@media (max-width: 599px) {
 .site-header { display: grid; grid-template-columns: minmax(0,1fr) auto auto; align-items: center; gap: .25rem .375rem; padding: .625rem .75rem; }
 .site-header > div:first-child { grid-column: 1 / 3; min-width: 0; }
 .site-header .logo { font-size: 1.0625rem; }
 .account-actions { display: contents; }
 .site-header .account-button { min-height: 44px; white-space: nowrap; text-align: center; }
 .community-actions { grid-column: 3; grid-row: 1; flex-direction: column-reverse; align-items: stretch; gap: .125rem; }
 .site-header .online-button { justify-content: center; min-height: 20px; padding: 0; gap: .25rem; font-size: .6875rem; }
 .account-summary { grid-column: 1 / -1; grid-row: 2; min-width: 0; padding-bottom: .375rem; font-size: .75rem; }
 :is(#membership-btn,#mt-membership) { grid-column: 1; grid-row: 3; }
 :is(#auth-btn,#mt-login) { grid-column: 2 / -1; grid-row: 3; }
 :is(#admin-link,#mt-admin) { grid-column: 2; grid-row: 3; display: flex; align-items: center; justify-content: center; }
 :is(#logout-btn,#mt-logout) { grid-column: 3; grid-row: 3; }
 .mobile-notice { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .75rem; padding: 0 .5rem 0 .875rem; border-radius: 4px; background: #eaf1ff; color: #345284; font-size: .8125rem; }
 .mobile-notice button { flex-shrink: 0; min-width: 44px; min-height: 44px; border: 0; background: none; padding: .25rem; font: inherit; font-size: 1.5rem; line-height: 1; cursor: pointer; color: var(--text-color-secondary); }
}
@media (max-width: 359px) {
 .site-header .logo { font-size: .9375rem; }
 .container { padding-left: max(.75rem, env(safe-area-inset-left)); padding-right: max(.75rem, env(safe-area-inset-right)); }
}
@media (min-width: 600px) {
 .site-header, .site-header .account-actions { flex-wrap: nowrap; }
 .site-header .site-brand-row, .site-header .account-button { flex-shrink: 0; white-space: nowrap; }
 .site-header .account-summary { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
 .site-header .online-button { inline-size: 10.5rem; }
 html[lang="zh-CN"] .site-header .online-button { inline-size: 7.25rem; }
}
@media (max-width: 599px) {
 .site-header .site-brand-row { justify-content: flex-start; gap: .375rem .65rem; }
 .site-header .online-button { inline-size: 6.5rem; }
 html[lang="ug"] .site-header .online-button { inline-size: 7rem; }
 .site-header .account-summary { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.6; }
 html[data-site-signed-in] .site-header .account-summary:empty { display: block; block-size: calc(1.2rem + .5rem); visibility: hidden; }
}
@media (pointer: coarse) { .account-button { min-height: 44px; } }
@media (prefers-reduced-motion: reduce) {
 html { scroll-behavior: auto; }
 *,*::before,*::after { animation: none!important; transition: none!important; }
 .account-button:active:not(:disabled) { transform: none; }
}

/* Keep the navigation usable with longer localized labels on narrow screens. */
.site-sections { flex-wrap: wrap; }
@media (max-width: 420px) {
 .site-sections a { padding-inline: .65rem; }
}
