html,
body {
    touch-action: manipulation;
    /* 禁止双击缩放 */
}

:root {
    --app-vh: 100vh;
    --app-bottom-inset: env(safe-area-inset-bottom, 0px);
}

* {
    margin: 0;
    padding: 0;
    /* user-select: none; */
}

body {
    overflow: hidden;
    height: var(--app-vh);
    background: #1E1C16;
    color: #43403B;
    font-family: "ChillDIN", "Barlow Condensed", "ChillDINGothic";
    transition: opacity 0.8s, transform 0.8s;
}

#app-root {
    opacity: 1;
}

body.boot-pending #app-root {
    opacity: 1;
}

body.boot-ready #app-root {
    opacity: 1;
}

#boot-progress {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100000;
    background: radial-gradient(circle at 20% 20%, #f8f3ea 0%, #f3efe7 45%, #ece4d8 100%);
    opacity: 1;
    transition: opacity 480ms ease;
}

#boot-progress.is-fading {
    opacity: 0;
    pointer-events: none;
}

#boot-progress-text,
#boot-progress-track {
    width: min(420px, calc(100vw - 40px));
    max-width: 420px;
}

#boot-progress-track {
    position: relative;
    height: 1.37px;
    background-color: #43403B;
}

#boot-progress-indicator {
    position: absolute;
    top: 50%;
    left: 0%;
    width: 13px;
    height: 13px;
    background-color: #43403B;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: left 220ms ease;
}

#boot-progress-text {
    margin-top: 18px;
    color: rgba(57, 47, 23, 0.82);
    text-align: left;
    font-family: "Barlow Condensed", "ChillDIN", sans-serif;
    font-size: 12px;
    letter-spacing: 0.4px;
}

img {
    user-select: none;
    /* 禁止文字/图片被选中 */
    -webkit-user-drag: none;
    /* 禁止图片被拖动（Chrome/Safari） */
    -moz-user-select: none;
    /* Firefox 禁止选中 */
    -ms-user-select: none;
    /* IE/Edge 旧版 */
}

/* 文本样式 */
p,
h3 {
    font-family: "ChillDINGothic", "ChillDIN";
}

h1.Chinese {
    color: #43403B;
    text-align: center;
    font-family: "ChillDIN";
    font-size: 42px;
    font-weight: 700;
}

h1.English {
    color: #43403B;
    text-align: center;
    font-family: "Stint Ultra Condensed";
    font-size: 42px;
}





.hidden {
    transition: opacity 0.8s, transform 0.8s;
    opacity: 0 !important;
    pointer-events: none;
}

#word-details {
    opacity: 1;
    transition: opacity 500ms ease-in-out;
}

#word-details.details-transition-out {
    opacity: 0;
    pointer-events: none;
}

/* 主视图 */
#universe-view {
    position: relative;
    width: 100vw;
    height: var(--app-vh);
    display: flex;
    justify-content: center;
    align-items: center;
    perspective: 1000px;
    transform-origin: center center;
    overflow: hidden;
    cursor: grab;

    transition: left 0.3s ease-in-out;

    user-select: none;
}

#universe-view:active {
    cursor: grabbing;
}

#universe-canvas,
#connection-lines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: var(--app-vh);
}

#universe-canvas {
    z-index: 1;
}

#connection-lines {
    pointer-events: none;
    z-index: 30;

    transition: left 0.3s ease-in-out;
}

#connection-lines line {
    pointer-events: stroke;
}

#connection-lines path {
    pointer-events: stroke;
}



/* 单词节点 */
#word-nodes-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: var(--app-vh);
    background: rgba(0, 0, 0, 0.1);
    pointer-events: none;
    z-index: 20;
}

#focused-node-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 41;
}

#focused-node-layer .word-node {
    pointer-events: auto;
}

.word-node {
    box-sizing: border-box;
    /* overflow: hidden; */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    
    /* 原来固定的宽度改成最小宽度 */
    min-width: 46px;
    width: auto;
    height: 16px;

    overflow: visible; /* 让文字可以撑开 */
    border-radius: 5px;

    pointer-events: auto;
    position: absolute;
    cursor: pointer;
}

.word-node * {
    margin: 0;
    padding: 0;
}

.word-node .terms {
    /* overflow: hidden; */
    text-overflow: ellipsis;
    white-space: nowrap;
    display: flex;
    flex-direction: column;
    gap: 0;
    align-items: flex-start;
}

.word-node .detail-title {
    /* overflow: hidden; */
    text-overflow: ellipsis;
    white-space: nowrap;
}

.term-main {
    color: #43403B;
    font-family: "ChillDIN";
    font-weight: 600;
    margin: 0;
    padding: 0;
    letter-spacing: -1.287px;
}

html:lang(en) .word-node .terms .term-main {
    font-family: "Stint Ultra Condensed";
}

.term-ori {
    color: #43403B;
    font-family: "Stint Ultra Condensed";
    font-weight: 400;
    margin: 0;
    padding: 0;
}


/* .word-node::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-repeat: repeat;
    background-size: 120px 120px;
    opacity: .70;
    mix-blend-mode: multiply;
    background-image: url("data:image/svg+xml;utf8,\
<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'>\
  <filter id='n'>\
    <feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/>\
    <feColorMatrix type='saturate' values='0'/>\
  </filter>\
  <rect width='100%' height='100%' filter='url(%23n)'/>\
</svg>");
} */

.detail {
    position: absolute;
    transform: translate(-50%, -50%);
    border-radius: 5px;
    overflow: hidden;

    display: flex;
    flex-direction: column;
    justify-content: space-between;

    z-index: 40;

    box-shadow: #403b2c58 0px 0px 2px 2px;
    cursor: pointer;
}

#word-details .detail:hover {
    z-index: 42;
}

.detail * {
    margin: 15px 12px;
    cursor: inherit;
}

.detail i {
    font-style: italic;
    margin: 0;
}

.detail-title {
    color: #43403B;
    font-family: "Barlow Condensed";
    font-size: 16px;
    font-style: normal;
    font-weight: 600;
    line-height: 19.835px; /* 123.967% */

    
    margin: 10px 40px;
    display: flex;
    align-items: center;
    letter-spacing: 0;
    gap: 6px;
    position: relative;
}

.detail-title::before {
    content: '';
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #43403B;
    display: inline-block;
}



/* 噪点覆盖层 */
/* .detail::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-repeat: repeat;
    background-size: 120px 120px;
    opacity: .70;
    mix-blend-mode: multiply;
    background-image: url("data:image/svg+xml;utf8,\
<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'>\
  <filter id='n'>\
    <feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/>\
    <feColorMatrix type='saturate' values='0'/>\
  </filter>\
  <rect width='100%' height='100%' filter='url(%23n)'/>\
</svg>");
} */


#term {
    width: 328px;
    height: 213px;
    top: 50vh;
    left: 50vw;
    background-color: #FAD67B;

    opacity: 0;
    display: none;
}

#term .terms {
    margin: 10px;
    display: flex;
    flex-direction: column;
    gap: 0px;
    align-items: flex-start;
}

#term h1 {
    margin: 0;
    font-family: "ChillDINGothic";
    font-weight: 600;
    font-size: 42px;
    letter-spacing: -3%;
}

#term .term-main {
    margin: 0;
    padding: 0;
    color: #43403B;
    font-family: "ChillDINGothic";
    font-size: 42.911px;
    font-style: normal;
    font-weight: 600;
    letter-spacing: -1.287px;
    text-wrap: nowrap;
}

#term .term-ori {
    margin: 0;
    padding: 0;
    color: #43403B;
    font-family: "Stint Ultra Condensed";
    font-size: 61.06px;
    font-style: normal;
    font-weight: 400;
    text-wrap: nowrap;
}


#image {
    min-width: 120px;
    min-height: 150px;
    background-color: #E8D8B4;
}

#image .detail-title {
    margin-bottom: 16px;
}

#image .related-works {
    margin-top: 0;
    margin-bottom: 0;
}

#image img {
    max-width: 16vw;
    max-height: 16vw;
    object-fit: contain;
    border-radius: 4px;
    opacity: 0.7;
    filter: saturate(0.1);
    mix-blend-mode: plus-darker;
    padding: 0 12px 15px 12px;
    margin: 16px auto 0;
    display: block;
}

.lazy-img {
    background-color: #d9d0c3;
    transition: background-color 0.3s ease;
}

.lazy-img-error {
    background-color: #c3b3a0;
}


#proposer {
    width: 260px;
    min-height: 160px;
    background-color: #E6D9D0;
    --proposer-name-color: #E6D9D0;
}

#proposer .detail-title {
    margin-bottom: 16px;
}

#proposer img {
    max-width: 20vw;
    max-height: 20vw;
    object-fit: contain;
    border-radius: 4px;
    /* margin: 10px; */
    opacity: 0.7;
    filter: saturate(0.1);
    mix-blend-mode: darken;
    padding: 0 12px 15px 12px;
    margin: 16px 12px 15px;
    position: relative;
    z-index: 1;
}

#proposer .proposer-text {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 20px;
    z-index: 2;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#proposer .proposer-text .proposer-primary {
    color: var(--proposer-name-color);
    margin: 0;
    font-family: ChillDINGothic Condensed;
    font-size: 24px;
    font-style: normal;
    font-weight: 600;
    line-height: 5px; 
    letter-spacing: 1.2px;
}
html:lang(en) #proposer .proposer-text .proposer-primary {
    color: var(--proposer-name-color);
    text-align: center;
    font-family: "Stint Ultra Condensed";
    font-size: 39.48px;
    font-style: normal;
    font-weight: 400;
    line-height: 36px;
    letter-spacing: 0;
    padding-bottom:20px
}

#proposer .proposer-ori {
    color: var(--proposer-name-color);
    text-align: center;
    font-family: "Stint Ultra Condensed";
    font-size: 21.933px;
    font-style: normal;
    font-weight: 400;
    line-height: 20px;
}

#proposer .proposer-ori:empty {
    display: none;
}

html:lang(en) #proposer .proposer-ori {
    display: none;
}

#comment {
    max-width: 35vw;
    min-height: 240px;
    background-color: #B4B596;
}

#comment h3 {
    color: #43403B;
    font-family: "ChillDIN";
    font-size: 28.834px;
    font-style: normal;
    font-weight: 600;
    line-height: 36.898px;
    /* 127.969% */
    letter-spacing: -0.865px;
}

#comment p {
    color: #43403B;
    text-align: right;
    font-family: "ChillDINGothic";
    font-size: 17.3px;
    font-style: normal;
    font-weight: 700;
}

#comment .comment-abs-content {
    color: #43403B;
    font-family: "Barlow Condensed";
    font-size: 24px;
    font-style: normal;
    font-weight: 500;
    line-height: 30px;
    letter-spacing: -0.72px;
}


#overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: var(--app-vh);
    background-color: #625136;
    opacity: 0;
    transition: opacity 0.8s;
    pointer-events: none;
}




/* 联动主浮窗整体平移 */
#floating-panel.shifted {
    transform: translateY(60px) !important;
}



@keyframes breathing {

    0%,
    100% {
        transform: translate(0, 0);
        opacity: 0.85;
    }

    50% {
        transform: translate(0, -8px);
        opacity: 1;
    }
}

#sand-layer {
    position: absolute; /* 保证覆盖在 universe-view 内 */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* 不阻挡下方交互 */
    opacity: 0.25; /* 透明度50% */
    mix-blend-mode: multiply; /* 可以改成 darken / multiply / lighten / screen 等效果 */
    z-index: 10; /* 确保比 canvas 下方内容高，但比 panel/menu 低 */
    transform-origin: 0 0;
}


#center-dot {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background-color: red;
    transform: translate(-50%, -50%);
    z-index: 9999;
    pointer-events: none;
    /* 可选：让它不挡住鼠标点击 */
}
