/* === 字体 === */
@font-face {
    font-family: 'Unifont';
    src: url('../unifont-17.0.03.otf') format('opentype');
    font-weight: normal;
    font-style: normal;
}

/* === CSS 变量 === */
:root {
    --bg-color: #ffffff;
    --text-color: #000000;
    --link-color: #0000ff;
    --font-size: 14px;
    --line-height: 20px;
    --font-family: 'Unifont', monospace;
}

/* === 全局样式 === */
body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-family);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    cursor: none;  /* 全局隐藏原生光标 */
}

/* === 网格容器 === */
#grid {
    display: flex;
    flex-wrap: wrap;
    width: fit-content;
    height: fit-content;
    user-select: none;
    cursor: none;
}

/* === 单元格样式 === */
.cell {
    width: 1ch;
    height: var(--line-height);
    display: inline-flex;
    justify-content: center;
    align-items: center;
    white-space: pre;
    transition: color 0.1s, font-weight 0.1s;
    cursor: none;
    flex-shrink: 0;
}

/* 全宽字符（中文等）占用两个字符宽度 */
.cell.wide {
    width: 2ch;
}

/* 被全宽字符占用的单元格（隐藏） */
.cell.skip {
    display: none;
}

/* 1. 伪装状态：所有单词看起来都是蓝色链接 */
.cell.mask {
    color: var(--link-color);
    text-decoration: underline;
    font-weight: normal;
    cursor: none;
}

/* 2. 现形状态 - 普通词 (变成黑色，无下划线) */
.cell.text {
    color: var(--text-color);
    text-decoration: none;
    font-weight: normal;
    cursor: none;
}

/* 3. 现形状态 - 关键词 (保持蓝色，默认非粗体，hover 时变粗) */
.cell.link-active {
    color: var(--link-color);
    text-decoration: underline;
    font-weight: normal;
    cursor: none;
}

.cell.link-active-hover {
    /* 使用 text-shadow 模拟粗体效果，避免 Firefox 合成粗体导致的布局抖动 */
    text-shadow: 
        -0.3px 0 0 currentColor,
        0.3px 0 0 currentColor,
        0 0 1px currentColor;
}

/* 4. 已揭示的链接（普通蓝色） */
.cell.link-revealed {
    color: var(--link-color);
    text-decoration: underline;
    font-weight: normal;
    cursor: none;
}

/* 整个关键词组 hover 时变粗 */
.cell.link-hover {
    /* 使用 text-shadow 模拟粗体效果，避免 Firefox 合成粗体导致的布局抖动 */
    text-shadow: 
        -0.3px 0 0 currentColor,
        0.3px 0 0 currentColor,
        0 0 1px currentColor;
}

/* ASCII 艺术字符 */
.cell.art {
    color: #555;
    cursor: none;
}

/* === 图片 Overlay === */
#image-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    cursor: pointer;
}

#image-overlay.hidden {
    display: none;
}

#overlay-image {
    max-width: 90%;
    max-height: 85%;
    object-fit: contain;
}

#overlay-hint {
    margin-top: 20px;
    color: #666;
    font-family: var(--font-family);
    font-size: 12px;
}

/* === 版权信息 === */
#copyright {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 14px;
    color: var(--text-color);
    opacity: 0.6;
    user-select: none;
    pointer-events: none;
}

/* === 圆形光标 === */
#cursor-circle {
    position: fixed;
    width: 30px;
    height: 30px;
    border: 2px solid rgba(0, 0, 0, 0.2);
    border-radius: 50%;
    pointer-events: none;
    transform: translate(-50%, -50%);
    z-index: 999;
    display: none;
    box-sizing: border-box;
    transition: border-color 0.1s ease, width 0.2s ease, height 0.2s ease;
}

#cursor-circle.active {
    display: block;
}

#cursor-circle.on-link {
    border-color: rgba(0, 0, 255, 0.5);
}

/* === 响应式设计 === */
@media (max-width: 600px) {
    :root {
        --font-size: 10px;
        --line-height: 14px;
    }
    #copyright {
        font-size: 10px;
        bottom: 5px;
    }
}
