/* 3D Trackball Styles */

/* 核心容器 */
#trackball-container {
    position: relative;
    width: 95vw;
    left: 50%;
    transform: translateX(-50%);

    height: 60vw;
    margin-top: 0;
    margin-bottom: 0;

    perspective: 1200px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: grab;

    /* 1. 只裁切上下边界（防止盖住文字），不裁切左右 */
    overflow-y: clip;
    overflow-x: visible;
    z-index: 20;
}

#trackball-container:active {
    cursor: grabbing;
}

.trackball-grid-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
}

/* 中心文字叠加层 */
.trackball-center-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    pointer-events: none;
    z-index: 0;
    width: auto;
}

.trackball-center-text h2 {
    /* 3. 第一行字体缩小到 2/3 */
    color: transparent;
    -webkit-text-stroke: 1.5px #7d4487;
    font-size: 5.3vw;
    margin: 0 0 1.5vw 0;
    /* 增加下边距，制造首行间隔 */
    font-weight: 900;
    /* 3. 增强立体效果 */
    text-shadow:
        1px 1px 0 #fff,
        2px 2px 0 #fff,
        3px 3px 0 #fff,
        4px 4px 0 rgba(125, 68, 135, 0.2);
    font-family: inherit;
    letter-spacing: 0.3vw;
}

.trackball-center-text p {
    color: #7d4487;
    /* 填充色 */
    -webkit-text-stroke: 0.5px #7d4487;
    font-size: 3.5vw;
    margin: 0;
    /* 清除默认边距，完全由下行 margin-top 控制 */
    font-weight: 800;
    background: transparent;
    padding: 0;
    border-radius: 0;
    display: block;
    /* 保留 3D 立体视效 */
    text-shadow:
        1px 1px 0 #fff,
        2px 2px 0 #fff,
        2.5px 2.5px 0 rgba(125, 68, 135, 0.15);
}

.trackball-center-text p.sub {
    color: #7d4487;
    /* 填充色 */
    font-size: 3vw;
    margin-top: 0.35vw;
    /* 2、3行间距设定在 0.2~0.5vw 之间 */
    opacity: 1.0;
}

/* 适配大屏：限制最大尺寸 */
@media (min-width: 1024px) {
    #trackball-container {
        max-width: 1000px;
        width: 95vw;
        max-height: 600px;
        height: 625px;
    }

    .trackball-center-text h2 {
        font-size: 53px;
        margin-bottom: 15px;
    }

    .trackball-center-text p {
        font-size: 35px;
    }

    .trackball-center-text p.sub {
        font-size: 30px;
        margin-top: 4px;
    }
}

/* 3D 变换中心云 */
.trackball-cloud {
    position: absolute;
    top: 50%;
    left: 50%;
    transform-style: preserve-3d;
    width: 0;
    height: 0;
}

/* 标签块样式 */
.trackball-tag {
    position: absolute;
    top: 0;
    left: 0;
    transform: translate(-50%, -50%);
    font-weight: bold;
    border-radius: 0.5vw;
    text-align: center;
    cursor: pointer;
    box-shadow:
        0.1vw 0.1vw 0px #5a2d63,
        0.2vw 0.2vw 0px #5a2d63,
        0.3vw 0.3vw 0px #5a2d63,
        0.4vw 0.4vw 0.6vw rgba(0, 0, 0, 0.2);
    border: 0.1vw solid rgba(255, 255, 255, 0.2);
    transition: opacity 0.3s;
    will-change: transform, z-index;
    display: flex;
    justify-content: center;
    align-items: center;
    line-height: 1.3;
    user-select: none;
    -webkit-user-select: none;
}

/* 形状变体 - 全部改为响应式单位 */
.trackball-shape-square {
    width: 4vw;
    height: 4vw;
    font-size: 1vw;
    padding: 0.3vw;
    min-width: 30px;
    min-height: 30px;
}

.trackball-shape-large {
    width: 6vw;
    /* 1.5x of 4vw */
    height: 6vw;
    font-size: 1.3vw;
    padding: 0.5vw;
    z-index: 10;
    min-width: 45px;
    /* 1.5x of 30px */
    min-height: 45px;
}

.trackball-shape-rect {
    padding: 0.6vw 1.2vw;
    font-size: 1.2vw;
    white-space: nowrap;
    height: auto;
    min-font-size: 10px;
}

/* 颜色变体 */
.trackball-color-purple {
    background-color: #7d4487;
    color: #ffffff;
}

.trackball-color-white {
    background-color: #ffffff;
    color: #7d4487;
    border: 0.2vw solid #7d4487;
    box-shadow: 0.1vw 0.1vw 0px #a67bb0, 0.2vw 0.2vw 0px #a67bb0, 0.3vw 0.3vw 0px #a67bb0;
}

.trackball-color-light {
    background-color: #e6d0ed;
    color: #5a2d63;
    border: 0.1vw solid #cbb0d1;
}

/* 激活阶段 */
.trackball-tag.is-active {
    z-index: 10000 !important;
    filter: brightness(1.1);
    box-shadow:
        0.2vw 0.2vw 0px #5a2d63,
        0.4vw 0.4vw 0px #5a2d63,
        1.2vw 1.2vw 2vw rgba(0, 0, 0, 0.3);
    /* 移除 transform 过渡，因为它会与 JS 的频率更新产生冲突导致闪烁 */
    transition: opacity 0.3s;
}

/* 针对极小屏幕的修正 */
@media (max-width: 640px) {
    .trackball-shape-square {
        font-size: 8px;
    }

    .trackball-shape-large {
        font-size: 12px;
    }

    .trackball-shape-rect {
        font-size: 10px;
    }
}