@font-face {
    font-family: UFMSANSR;
    src: url('NaS/NotoUnicode-7.3.woff') format('woff');
}
@font-face {
    font-family: CC;
    src: url('font/CtrlCtrl-1.1.woff') format('woff');
}
@font-face {
    font-family: KSM;
    src: url('font/KreativeSquare-Medium.woff') format('woff');
}
@font-face {
    font-family: LRR;
    src: url('font/LastResort-Regular.woff') format('woff');
}
@font-face {
    font-family: MT;
    src: url('font/MonuTemp-0.92.woff') format('woff');
}
@font-face {
    font-family: NGM;
    src: url('font/NewGardiner-Medium.woff') format('woff');
}
@font-face {
    font-family: NCER;
    src: url('font/NotoColorEmoji-Regular.woff') format('woff');
}
@font-face {
    font-family: NSSR;
    src: url('font/NotoSansSuper-Regular.woff') format('woff');
}
@font-face {
    font-family: NU;
    src: url('font/NotoUnicode-7.3.woff') format('woff');
}
@font-face {
    font-family: PP1;
    src: url('font/PlangothicP1-Regular.woff') format('woff');
}
@font-face {
    font-family: PP2;
    src: url('font/PlangothicP2-Regular.woff') format('woff');
}
@font-face {
    font-family: SHSSCR;
    src: url('font/SourceHanSansSC-Regular.woff') format('woff');
}
@font-face {
    font-family: UFSEER;
    src: url('font/UFSEmojiExt-Regular.woff') format('woff');
}
@font-face {
    font-family: UFSZER;
    src: url('font/UFSZeroExt-Regular.woff') format('woff');
}
@font-face {
    font-family: USR;
    src: url('font/UnicodiaSesh-Regular.woff') format('woff');
}
@font-face {
    font-family: NER;
    src: url('font/NotoEmoji-Regular.woff') format('woff');
}

/* 全局变量与重置 */
:root {
    --bg: #ffffff;
    --fg: #111111;
    --card: #ffffff;
    --line: #e5e5e5;
    --hover: #f0f0f0;
    --accent: #667eea;
    --accent-light: #a3b5ff;
    --shadow: rgba(0, 0, 0, 0.1);
    --grid-size: 16;
}

[data-theme="dark"] {
    --bg: #121212;
    --fg: #e5e5e5;
    --card: #1e1e1e;
    --line: #333333;
    --hover: #2a2a2a;
    --accent: #9f7bff;
    --accent-light: #c6b0ff;
    --shadow: rgba(0, 0, 0, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: background-color 0.3s, color 0.3s, border-color 0.3s;
}

body {
    font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
    background: var(--bg);
    color: var(--fg);
    line-height: 1.6;
    padding: 20px;
    min-height: 100vh;
    background-image: radial-gradient(circle at 10% 20%, rgba(0, 0, 0, 0.03) 0%, rgba(0, 0, 0, 0) 100%);
}

[data-theme="dark"] body {
    background-image: radial-gradient(circle at 10% 20%, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0) 100%);
}

/* 移动设备提示样式 */
.mobile-notice {
    background-color: #fff3cd;
    color: #856404;
    padding: 15px;
    margin: 10px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid #ffeeba;
    margin-bottom: 20px;
}

[data-theme="dark"] .mobile-notice {
    background-color: #343a40;
    color: #ffeeba;
    border-color: #856404;
}

.mobile-message {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    color: #495057;
    grid-column: 1 / -1;
    text-align: center;
}

[data-theme="dark"] .mobile-message {
    background-color: #2c3034;
    color: #e9ecef;
}

/* 布局与容器 */
.container {
    max-width: 1400px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 3px;
    padding: 2px 0;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    background: linear-gradient(90deg, var(--accent), var(--accent-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 2px 4px var(--shadow);
}

/* 控制面板 */
#controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 30px;
    padding: 15px 20px;
    background: var(--card);
    border-radius: 12px;
    box-shadow: 0 4px 12px var(--shadow);
    border: 1px solid var(--line);
}

.controls-left, .controls-right {
    display: flex;
    gap: 15px;
    align-items: center;
}

#search {
    padding: 10px 15px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--bg);
    color: var(--fg);
    width: 300px;
    font-size: 1rem;
	font-family: UFMSANSR, NER, PP1, PP2, SHSSCR, LRR;
}

#search:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

button {
    padding: 10px 20px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--card);
    color: var(--fg);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.2s;
}

button:hover {
    background: var(--hover);
    transform: translateY(-2px);
}

button:active {
    transform: translateY(1px);
}

#themeToggle {
    background: var(--accent);
    color: white;
    border: none;
}

#themeToggle:hover {
    background: var(--accent-light);
}

#count {
    font-size: 1.1rem;
    font-weight: 500;
    padding: 8px 16px;
    background: var(--hover);
    border-radius: 8px;
}

/* 网格容器 */
#wrapper {
    position: relative;
    height: 70vh;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--card);
    box-shadow: 0 4px 20px var(--shadow);
}

/* 网格视图 */
.grid-view {
    display: grid;
    grid-template-columns: repeat(16, 1fr);
    gap: 12px;
    padding: 20px;
}

.block-card {
    position: relative;
    aspect-ratio: 1/3;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s;
    overflow: hidden;
    box-shadow: 0 2px 6px var(--shadow);
}

.block-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 15px var(--shadow);
    border-color: var(--accent);
    z-index: 10;
}

.block-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--accent);
    opacity: 0.7;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s;
}

.block-card:hover::before {
    transform: scaleX(1);
}

.block-char {
    font-size: 1.8rem;
    margin-bottom: 8px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
	font-family: UFMSANSR, NER, PP1, PP2, SHSSCR, LRR;
}

.block-name {
    font-size: 0.75rem;
    text-align: center;
    font-weight: 500;
    opacity: 0.9;
    line-height: 1.3;
}

.block-range {
    position: absolute;
    bottom: 5px;
    left: 0;
    width: 100%;
    text-align: center;
    font-size: 0.7rem;
    opacity: 0.7;
    padding: 0 5px;
}

/* 详情视图 */
#detailView {
    display: none;
    padding: 20px;
}

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--line);
}

.detail-title {
    font-size: 1.8rem;
    font-weight: 700;
}

.detail-subtitle {
    font-size: 1.1rem;
    opacity: 0.8;
    margin-top: 5px;
}

.char-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 10px;
    margin-top: 20px;
}

.char-item {
    aspect-ratio: 1/1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
	font-family: UFMSANSR, NER, PP1, PP2, SHSSCR, LRR;
}

.char-item:hover {
    background: var(--hover);
    transform: scale(1.05);
    border-color: var(--accent);
}

.char-limit-msg {
    grid-column: 1 / -1;
    text-align: center;
    padding: 10px;
    opacity: 0.7;
    font-size: 0.9rem;
    color: var(--fg);
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .grid-view {
        grid-template-columns: repeat(12, 1fr);
    }
    
    .char-grid {
        grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    }
}

@media (max-width: 900px) {
    .grid-view {
        grid-template-columns: repeat(10, 1fr);
    }
    
    .char-grid {
        grid-template-columns: repeat(auto-fill, minmax(45px, 1fr));
    }
    
    .block-name {
        font-size: 0.7rem;
    }
}

@media (max-width: 768px) {
    .grid-view {
        grid-template-columns: repeat(8, 1fr);
    }
    
    .char-grid {
        grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .detail-title {
        font-size: 1.5rem;
    }
    
    .detail-subtitle {
        font-size: 1rem;
    }
    
    #controls {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .controls-left, .controls-right {
        width: 100%;
        justify-content: space-between;
    }
    
    #search {
        width: 100%;
    }
    
    button {
        padding: 8px 15px;
        font-size: 0.9rem;
    }
}

@media (max-width: 576px) {
    body {
        padding: 10px;
    }
    
    .grid-view {
        grid-template-columns: repeat(6, 1fr);
        gap: 8px;
        padding: 10px;
    }
    
    .char-grid {
        grid-template-columns: repeat(auto-fill, minmax(35px, 1fr));
        gap: 5px;
    }
    
    .block-card {
        aspect-ratio: 1/1.5;
    }
    
    .block-char {
        font-size: 1.5rem;
        height: 30px;
    }
    
    .block-name {
        font-size: 0.6rem;
        padding: 0 3px;
    }
    
    .block-range {
        font-size: 0.6rem;
    }
    
    .detail-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    #copyBlock {
        width: 100%;
        justify-content: center;
    }
    
    .char-item {
        font-size: 1.5rem;
    }
}

@media (max-width: 400px) {
    .grid-view {
        grid-template-columns: repeat(4, 1fr);
    }
    
    h1 {
        font-size: 1.8rem;
    }
    
    .char-grid {
        grid-template-columns: repeat(auto-fill, minmax(30px, 1fr));
    }
    
    .char-item {
        font-size: 1.2rem;
    }
    
    button {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
    
    #search {
        padding: 8px 12px;
    }
}

/* 横屏模式优化 */
@media (orientation: landscape) and (max-height: 500px) {
    #wrapper {
        height: 60vh;
    }
    
    .grid-view {
        grid-template-columns: repeat(10, 1fr);
    }
    
    .block-card {
        aspect-ratio: 1/1.2;
    }
}

/* 平板设备优化 */
@media (min-width: 768px) and (max-width: 1024px) {
    .grid-view {
        grid-template-columns: repeat(12, 1fr);
    }
    
    .char-grid {
        grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    }
}

/* 滚动条美化 */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-light);
}