* {
    margin: 0;
    padding: 0;
}

html, body {
    width: 100%;
    height: 100%;
}

/* Prevent the page from bouncing at its scroll limits. */
html {
    overscroll-behavior: none;
}

body {
    background-color: #dfe8f7;
    color: #34405f;
    font-family: "Fira Code", "Microsoft YaHei", monospace;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

input,
textarea,
[contenteditable="true"] {
    -webkit-user-select: text;
    user-select: text;
    -webkit-touch-callout: default;
}

img {
    -webkit-user-drag: none;
    user-drag: none;
}

/* 背景单独成层：fixed 定位既不受滚动影响，也不会随拖动的终端一起重绘漂移 */
#bg {
    position: fixed;
    inset: 0 0 auto;
    /* Keep the cover crop stable as browser toolbars expand and retract. */
    height: 100vh;
    height: 100lvh;
    z-index: 0;
    pointer-events: none;
    /* 当前壁纸。地址由 JS 通过 --bg-img 注入，换图时只改变量 */
    background-image: var(--bg-img, url("https://t.alcy.cc/ycy"));
    background-repeat: no-repeat;
    background-position: center center;
    background-size: cover;
}

/* 换壁纸淡入层：新图先在此淡入盖住旧图，结束后再写回 #bg，避免直接替换瞬间跳变/闪白 */
#bg::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: var(--bg-next, none);
    background-repeat: no-repeat;
    background-position: center center;
    background-size: cover;
    opacity: 0;
    transition: opacity 0.45s ease;
}

#bg.is-fading::before {
    opacity: 1;
}

/* 冷色渐变罩始终在最上层，换图前后色调一致 */
#bg::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image: linear-gradient(135deg, rgba(72, 122, 220, 0.16), rgba(118, 92, 220, 0.10) 52%, rgba(62, 190, 230, 0.20));
}

/* 写回 #bg 后立即清空淡入层，避免多一次反向淡出 */
#bg.no-fade::before {
    transition: none;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background:
        radial-gradient(circle at 12% 18%, rgba(255, 255, 255, 0.62) 0 3px, transparent 4px),
        radial-gradient(circle at 82% 22%, rgba(190, 230, 255, 0.52) 0 5px, transparent 6px),
        radial-gradient(circle at 70% 72%, rgba(208, 210, 255, 0.48) 0 4px, transparent 5px);
    background-size: 160px 160px, 230px 230px, 190px 190px;
    opacity: 0.62;
}

.site-footer {
    position: fixed;
    left: 22px;
    bottom: 14px;
    z-index: 2;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-items: center;
    max-width: min(760px, calc(100vw - 44px));
    padding: 6px 10px;
    border-radius: 999px;
    color: rgba(54, 69, 98, 0.78);
    background: rgba(255, 255, 255, 0.44);
    font-size: 11px;
    line-height: 1.55;
    backdrop-filter: blur(8px);
}

.site-footer a {
    color: #486ba8;
    text-decoration: none;
}

.site-footer a:hover {
    color: #277fb9;
    text-decoration: underline;
}

.site-footer-separator {
    opacity: 0.5;
}

/* 电脑端（>1120px 分栏）锁死整页滚动；移动端（<=1120px 堆叠）保留滚动 */
@media screen and (min-width: 1121px) {
    html {
        height: 100%;
        overflow: hidden;
        overflow: clip;
        overscroll-behavior: none;
    }

    body {
        height: 100%;
        overflow: hidden;
        overflow: clip;
        overscroll-behavior: none;
    }
}

#box {
    width: 1200px;
    height: 100px;
    margin: 0 auto;
    padding-top: 5%;
    position: relative;
    z-index: 2;
}

.meBox {
    float: left;
    width: 20rem;
    height: 25rem;
    background: rgba(255, 255, 255, 0.96);
    margin-top: 100px;
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 24px;
    box-shadow: 0 16px 42px rgba(30, 48, 110, 0.22);
    transition: all 0.3s;
    text-align: center;
    position: relative;
}

/* 个人介绍卡片最小化按钮（同终端黄灯语义） */
.me-min-btn {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 2;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background-color: #ffd47a;
    box-shadow: 0 0 6px rgba(255, 212, 122, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    touch-action: manipulation;
    transition: transform 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.me-min-btn span {
    width: 10px;
    height: 2px;
    border-radius: 2px;
    background: rgba(122, 92, 20, 0.9);
    pointer-events: none;
}

/* 扩大点击热区 */
.me-min-btn::before {
    content: "";
    position: absolute;
    inset: -9px;
    border-radius: 50%;
}

.me-min-btn::after {
    content: attr(data-tip);
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    padding: 5px 8px;
    border-radius: 6px;
    background: rgba(38, 48, 82, 0.94);
    color: #fff;
    font-size: 11px;
    line-height: 1;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
    transform: translateY(-4px);
}

@media (hover: hover) and (pointer: fine) {
    .me-min-btn:hover {
        background-color: #ffd373;
        transform: scale(1.22);
        box-shadow: 0 0 8px #ffaf00;
    }

    .me-min-btn:hover::after {
        opacity: 1;
        transform: translateY(0);
    }
}

.me-min-btn:active {
    transform: scale(0.85);
    filter: brightness(1.2);
}

.me-min-btn:focus-visible {
    outline: 2px solid #2f9ff0;
    outline-offset: 3px;
}

/* 最小化：淡出收起，保留占位不位移 */
.meBox.mini {
    visibility: hidden;
    opacity: 0;
    transform: scale(0.94);
    pointer-events: none;
}

.meBox:hover {
    width: 21rem;
    height: 26rem;
    margin: 95px 0 0 -5px;
    box-shadow: 0 20px 48px rgba(30, 100, 190, 0.32);
}

.headPhoto {
    width: 8rem;
    height: 8rem;
    background: url(https://q1.qlogo.cn/g?b=qq&nk=842231256&s=640) no-repeat;
    background-size: 120%;
    background-position: center;
    border-radius: 50%;
    border: 5px solid rgba(255, 255, 255, 0.55);
    box-shadow: 0 8px 20px rgba(30, 60, 140, 0.28);
    overflow: hidden;
    position: relative;
    top: -15%;
    left: 50%;
    margin-left: -4rem;
    transition: all 0.3s;
}

.meBox:hover .headPhoto {
    width: 9rem;
    height: 9rem;
    margin: -0.5rem 0 0 -4.5rem;
    transform: rotate(360deg);
}

.headPhoto:hover {
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}

.meBox-title {
    width: auto;
    margin: 0 auto;
}

@keyframes typing {
    from {
        width: 0;
    }
}

@keyframes blink-caret {
    50% {
        border-color: transparent;
    }
}

.meBox-title-text {
    margin: -47px auto 0;
    line-height: 1.25;
}

.meBox-title-main {
    display: block;
    width: 6em;
    margin: 0 auto;
    font-size: 1.2rem;
    border-right: .1em solid;
    white-space: nowrap;
    overflow: hidden;
    animation: typing 2s steps(20, end), blink-caret .3s step-end infinite alternate;
    transition: all 0.3s;
}

.meBox-title-sub {
    display: block;
    margin-top: .35rem;
    color: #65748c;
    font-size: .76rem;
    letter-spacing: .04em;
}

.meBox:hover .meBox-title-main {
    font-size: 1.3rem;
}

.meBox-title .fg {
    width: 80%;
    height: 2px;
    background-image: linear-gradient(90deg, #5fd0f5, #8f9bff, #6ee7f0);
    border-radius: 999px;
    margin: 5% 0 0 10%;
}

.meBox-text {
    width: 80%;
    height: 45%;
    overflow: hidden;
    text-align: center;
    color: #46556f;
    animation-name: meBox-text;
    animation-duration: 2s;
    animation-fill-mode: forwards;
    margin: 5% 0 0 10%;
    transition: all 0.3s;
}

.meBox-text p {
    margin-top: 5px;
}

.meBox:hover .meBox-text {
    font-size: 1.05rem;
}

@keyframes meBox-text {
    0% {
        transform: translateY(50px);
        color: white;
    }

    100% {
        transform: translateY(0);
        color: rgb(58, 70, 95);
    }
}

.meBox-Button {
    width: 100%;
}

/* 两个按钮始终均分卡片宽度，拖动及悬停时都不会挤到下一行。 */
#meBox .meBox-Button {
    display: flex;
}

#meBox .meBox-Button a {
    float: none;
    flex: 1 1 0;
    min-width: 0;
    width: auto;
}

.meBox-Button a {
    display: inline-block;
    float: left;
    width: 158px;
    height: 50px;
    margin-top: 13px;
    line-height: 50px;
    text-decoration: none;
    color: #4a648f;
    font-weight: bold;
    transition: all 0.3s;
}

.meBox-Button a:hover {
    color: #2f9ff0;
    font-size: 1.2rem;
}

.meBox:hover .meBox-Button a {
    width: 165px;
    margin-top: 10px;
}

#cmdBox {
    width: 710px;
    height: 550px;
    float: right;
}

html,
body {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

/* 终端与音乐窗口共用外框样式。 */
.cmd,
.music-window {
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 20px 20px 12px 12px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 14px 34px rgba(28, 42, 96, 0.20);
    font-size: 14px;
    color: #3d4b68;
}

.cmd:hover,
.music-window:hover {
    box-shadow: 0 22px 48px rgba(30, 90, 180, 0.32);
}

.cmd {
    width: 600px;
    height: 400px;
    overflow: hidden;
    /* 不用 transition:all：显式列出属性、visibility 立即切换，避免关闭时窗口回弹 */
    transition: width 0.3s, height 0.3s, margin 0.3s, box-shadow 0.3s, border-radius 0.3s, opacity 0.3s,
        visibility 0s linear 0s;
    font-size: 14px;
    color: #3d4b68;
    position: relative;
    top: 0;
    left: 0;
}

.cmd:hover {
    width: 610px;
    height: 410px;
    margin: -5px 0 0 -5px;
}

#cmdBox .cmd.is-active {
    z-index: 10;
}

#cmdBox .cmd:hover,
#cmdBox .cmd:focus {
    z-index: 20;
}

.cmd .title,
.music-head {
    width: 100%;
    height: 25px;
    background: linear-gradient(90deg, rgba(170, 215, 255, 0.50), rgba(185, 175, 255, 0.42), rgba(165, 235, 255, 0.50));
    font-size: 14px;
    line-height: 25px;
}

.cmd .title span,
.music-head span {
    display: inline-block;
    width: 70%;
    text-align: center;
    color: #3e5587;
    font-weight: bold;
}

.cmd .click,
.music-controls {
    margin-left: 10px;
    float: left;
}

.cmd .click div,
.music-controls button {
    position: relative;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin: 8px 0 0 10px;
    float: left;
    touch-action: manipulation;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.cmd .click div::before,
.music-controls button::before {
    content: "";
    position: absolute;
    inset: -9px;
    border-radius: 50%;
}

.cmd .click div::after,
.music-controls button::after {
    content: attr(data-tip);
    position: absolute;
    top: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(-4px);
    padding: 5px 8px;
    border-radius: 6px;
    background: rgba(38, 48, 82, 0.94);
    color: #fff;
    font-size: 11px;
    line-height: 1;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

@media (hover: hover) and (pointer: fine) {
    .cmd .click div:hover,
.music-controls button:hover {
        transform: scale(1.3);
    }

    .cmd .click div:hover::after,
.music-controls button:hover::after {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.cmd .click div:active,
.music-controls button:active {
    transform: scale(0.85);
    filter: brightness(1.35);
}

.cmd .click .red,
.music-controls .red {
    background-color: #ff7a7a;
    box-shadow: 0 0 5px rgba(255, 122, 122, 0.6);
}

.cmd .click .red:hover,
.music-controls .red:hover {
    background-color: #ff5c5c;
    box-shadow: 0 0 3px #ff4d4d;
}

.cmd .click .yellow,
.music-controls .yellow {
    background-color: #ffd47a;
    box-shadow: 0 0 5px #ffd47a;
}

.cmd .click .yellow:hover,
.music-controls .yellow:hover {
    background-color: #ffd373;
    box-shadow: 0 0 3px #ffaf00;
}

.cmd .click .green,
.music-controls .green {
    background-color: #78d6b0;
    box-shadow: 0 0 5px rgba(120, 214, 176, 0.6);
}

.cmd .click .green:hover,
.music-controls .green:hover {
    background-color: rgb(0, 196, 36);
    box-shadow: 0 0 3px #00931a;
}

.cmdText {
    padding-top: 10px;
    padding-left: 15px;
}

.cmd2 {
    position: relative;
    top: -280px;
    left: 100px;
}

.cmd2 .cmdText .ul {
    margin-left: 15px;
}

.cmd2 .cmdText .ul a {
    text-decoration: none;
    color: #3e5f9e;
}

.cmd2 .cmdText .ul a:hover {
    color: #2f9ff0;
}

.contact-list {
    margin: 10px 0 12px 15px;
    line-height: 1.8;
}

.contact-list a {
    color: #3e5f9e;
    text-decoration: none;
}

.contact-list a:hover {
    color: #2f9ff0;
}

/* 自适应 */
@media screen and (max-width: 1250px) {
    #box {
        width: 100%;
    }

    .meBox {
        margin-left: 3%;
    }

    .meBox:hover {
        width: 21rem;
        height: 26rem;
        margin: 95px 0 0 2.5%;
    }

    #cmdBox {
        margin-right: 3%;
    }
}

@media screen and (max-width: 1120px) {
    #box {
        height: auto;
    }

    .meBox {
        float: none;
        margin: 100px auto 100px;
    }

    .meBox:hover {
        width: 20rem;
        height: 25rem;
        margin: 105px auto 100px;
    }

    .meBox:hover .meBox-Button a {
        width: 158px;
        height: 50px;
        margin-top: 13px;
    }

    .meBox:hover .meBox-title-main {
        font-size: 1.2rem;
    }

    .meBox:hover .headPhoto {
        width: 8rem;
        height: 8rem;
        margin: -0.5rem 0 0 -4rem;
        transform: rotate(360deg);
    }

    #cmdBox {
        float: none;
        margin: 0 auto 100px;
    }
}

@media screen and (max-width: 768px) {
    .site-footer {
        position: relative;
        left: auto;
        bottom: auto;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        justify-content: center;
        max-width: calc(100vw - 24px);
        width: fit-content;
        margin: 14px auto 104px;
        padding: 7px 12px;
        background: rgba(255, 255, 255, 0.68);
        text-align: center;
        overflow-wrap: anywhere;
    }

    .site-footer > span {
        display: inline;
        width: auto;
    }

    .meBox {
        width: 300px;
    }

    /* 触屏上放大最小化按钮，便于点按 */
    .me-min-btn {
        top: 12px;
        right: 12px;
        width: 26px;
        height: 26px;
    }

    .me-min-btn span {
        width: 12px;
    }

    .meBox:hover {
        width: 300px;
        height: 25rem;
        margin: 100px auto 100px;
    }

    .meBox-Button a:hover {
        color: rgb(0, 132, 255);
    }

    .meBox:hover .meBox-Button a {
        width: 150px;
        margin-top: 13px;
    }

    .meBox:hover .meBox-title-main {
        font-size: 1.2rem;
    }

    .meBox:hover .headPhoto {
        width: 8rem;
        height: 8rem;
        margin: -0.5rem 0 0 -4rem;
        transform: rotate(360deg);
    }

    .meBox:hover .meBox-text {
        font-size: 1rem;
    }

    .meBox-Button a {
        width: 150px;
    }

    #cmdBox {
        width: 100%;
        height: 1300px;
    }

    .cmd {
        width: 90%;
        margin: 0 auto;
    }

    .cmd2 {
        position: relative;
        top: 20px;
        left: 0;
    }

    .cmd:hover,
    .music-window:hover {
        box-shadow: 0 0 10px rgba(0, 0, 0, 0.4);
    }

    .cmd:hover {
        width: 90%;
        margin: 0 auto;
        z-index: 1;
    }
}

/* 交互终端 */
.cmd4 {
    position: relative;
    top: -560px;
    left: 200px;
    z-index: 3;
}

/* 桌面端用 min() 收住 200px 偏移，避免 <1384px 视口下超出右边界 */
@media screen and (min-width: 1121px) {
    .cmd4 {
        left: min(200px, calc(50vw - 497px));
    }
}

.cmd4 .cmdText {
    height: calc(100% - 25px);
    box-sizing: border-box;
    overflow-x: hidden;
    overflow-y: auto;
    /* 先滚动终端，到达边界后允许继续滚动网页 */
    overscroll-behavior-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 8px 12px 8px 15px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.cmd4 .cmdText::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

.term-out {
    white-space: pre-wrap;
    word-break: break-all;
    line-height: 1.65;
    font-size: 13px;
    user-select: none;
    -webkit-user-select: none;
}

.term-out a {
    color: #3e5f9e;
    text-decoration: none;
}

.term-out a:hover {
    color: #2f9ff0;
}

/* 实时天气那一行的输出 */
.weather-line {
    display: inline-block;
    padding: 3px 0;
    color: #3d4b68;
    font-size: 13px;
    user-select: none;
    -webkit-user-select: none;
}

.weather-line.is-error {
    color: #ff7a7a;
}

/* 取数期间闪一个终端光标 */
.weather-cursor {
    animation: weather-blink 1s step-end infinite;
}

@keyframes weather-blink {
    50% {
        opacity: 0;
    }
}

.term-line {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding: 2px 0 0;
}

.term-prompt {
    color: rgb(0, 190, 0);
    white-space: nowrap;
}

.term-input {
    flex: 1;
    width: 0;
    min-width: 0;
    border: none;
    outline: none;
    background: transparent;
    color: #3d4b68;
    font: inherit;
    caret-color: #2f9ff0;
}

@media screen and (max-width: 768px) {
    #cmdBox {
        height: auto;
        min-height: 1240px;
        padding-bottom: 24px;
        margin-bottom: 24px;
    }

    .cmd.cmd4 {
        top: 40px;
        left: 0;
        /* 手机端保持与桌面一致，不随输出无限增高 */
        height: 400px;
        min-height: 0;
    }

    .cmd4 .cmdText {
        height: calc(100% - 25px);
        min-height: 0;
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior-y: auto;
        touch-action: pan-y;
    }
}

/* 居中弹出 */
.cmd4.pop {
    position: fixed;
    top: 50%;
    left: 50%;
    margin: 0;
    transform: translate(-50%, -50%);
    width: min(760px, 94vw);
    height: min(520px, 84vh);
    box-shadow: 0 30px 80px rgba(8, 18, 60, 0.5);
    animation: pop-in 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.08);
}

#cmdBox .cmd4.pop {
    z-index: 901;
}

#cmdBox .cmd.full {
    position: fixed;
    top: 0;
    left: 0;
    margin: 0;
    transform: none;
    width: 100vw;
    height: 100vh;
    border-radius: 0;
    z-index: 930;
    box-shadow: none;
    animation: full-in 0.25s ease;
}

.cmd4.pop:hover {
    width: min(760px, 94vw);
    height: min(520px, 84vh);
    margin: 0;
    box-shadow: 0 30px 80px rgba(8, 18, 60, 0.5);
}

.cmd4.settled {
    animation: none;
}

.cmd4.dismiss-warn {
    animation: warn-shake 0.35s ease;
}

@keyframes pop-in {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }

    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes warn-shake {
    0%,
    100% {
        transform: translate(-50%, -50%) translateX(0);
    }

    20% {
        transform: translate(-50%, -50%) translateX(-8px);
    }

    40% {
        transform: translate(-50%, -50%) translateX(8px);
    }

    60% {
        transform: translate(-50%, -50%) translateX(-5px);
    }

    80% {
        transform: translate(-50%, -50%) translateX(5px);
    }
}

body.no-scroll {
    overflow: hidden;
}

/* 红绿灯按钮动作 */
/* 关闭/最小化终态：opacity:0 + animation:none 防回弹，visibility 延迟 0.3s 到淡出结束再隐藏 */
.cmd.closed,
.cmd.mini {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    animation: none;
    transition: width 0.3s, height 0.3s, margin 0.3s, box-shadow 0.3s, border-radius 0.3s, opacity 0.3s,
        visibility 0s linear 0.3s;
}

.cmd.closing {
    animation: close-out 0.28s ease-in forwards;
    pointer-events: none;
}

#cmdBox .cmd4.pop.closing {
    animation: close-out-pop 0.28s ease-in forwards;
}

.cmd.restore {
    animation: restore-in 0.25s ease;
}

@keyframes close-out {
    to {
        opacity: 0;
        transform: scale(0.04);
    }
}

@keyframes close-out-pop {
    to {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.04);
    }
}

@keyframes restore-in {
    from {
        opacity: 0;
        transform: scale(0.92);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes full-in {
    from {
        opacity: 0;
        transform: scale(0.96);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* 右下角悬浮区：丛雨入口 + dock 同处一根竖直流，丛雨永远排在 dock 上方，行数变化只会把它往上顶 */
.corner-stack {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 950;
    display: flex;
    flex-direction: column;
    align-items: flex-end; /* 靠右贴右下角 */
    gap: 10px;
    max-width: calc(100vw - 36px);
    pointer-events: none; /* 容器不拦点击，子元素各自开启 */
}

.dock-bar {
    display: flex;
    flex-direction: row-reverse;
    align-items: center;
    /* 胶囊变多向上折行，避免窄屏溢出 */
    flex-wrap: wrap-reverse;
    max-width: calc(100vw - 36px);
    gap: 10px;
    pointer-events: none; /* 容器不拦点击，避免折行后透明区域挡住下层 */
}

.term-dock {
    padding: 8px 16px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 10px 28px rgba(20, 40, 100, 0.3);
    color: #3e5587;
    font-family: "Fira Code", "Microsoft YaHei", monospace;
    font-size: 13px;
    cursor: pointer;
    /* 未唤出用 display:none，避免只降透明度仍占位、dock 平白多出一行 */
    display: none;
    align-items: center;
    opacity: 0;
    transform: translateY(16px);
    pointer-events: none;
}

.term-dock.show {
    display: inline-flex;
    animation: dock-pill-in 0.25s ease forwards; /* display 切换不触发 transition，用动画补淡入 */
    pointer-events: auto;
}

@keyframes dock-pill-in {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.term-dock:hover {
    color: #2f9ff0;
}

/* 换壁纸按钮常驻 dock（第一位 = row-reverse 下最右），作为右下角锚点 */
/* 音乐入口与换壁纸共用同一套胶囊外观：渐变底 + 白色图标文字 + 同尺寸间距 */
.wallpaper-btn,
.music-launcher {
    opacity: 1; /* 覆盖 .term-dock 的隐藏态，常驻可见 */
    transform: none;
    pointer-events: auto;
    position: relative; /* 悬停提示定位基准 */
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 15px;
    /* 渐变实色，与最小化胶囊区分 */
    background: linear-gradient(135deg, #4a8ff0, #7b6ef0);
    border-color: rgba(255, 255, 255, 0.55);
    color: #fff;
    transition: transform 0.12s ease, filter 0.15s ease, background 0.2s ease;
}

.wallpaper-btn svg,
.music-launcher svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
    pointer-events: none;
}

.wallpaper-btn:active,
.music-launcher:active {
    transform: scale(0.95);
}

.wallpaper-btn:focus-visible,
.music-launcher:focus-visible {
    outline: 2px solid #2f9ff0;
    outline-offset: 3px;
}

/* 悬停提示 */
.wallpaper-btn::after,
.music-launcher::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 10px);
    right: 0; /* 按钮贴着右下角，提示向左展开才不会溢出视口 */
    padding: 5px 8px;
    border-radius: 6px;
    background: rgba(38, 48, 82, 0.94);
    color: #fff;
    font-size: 11px;
    line-height: 1;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
    transform: translateY(4px);
}

/* 加载中：图标转圈 + 拦截连点 */
.wallpaper-btn.is-loading {
    color: rgba(255, 255, 255, 0.78);
    cursor: progress;
}

.wallpaper-btn.is-loading svg {
    animation: wall-spin 0.7s linear infinite;
}

/* 取图失败：短暂变红提示 */
.wallpaper-btn.is-error {
    background: linear-gradient(135deg, #e0724a, #d63f2c);
    color: #fff;
}

@keyframes wall-spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* 触屏没有 hover，提示只在有鼠标的设备上显示 */
@media (hover: hover) and (pointer: fine) {
    .wallpaper-btn:hover,
    .music-launcher:hover {
        filter: brightness(1.08);
        color: #fff; /* 压住 .term-dock:hover 的蓝色，保持胶囊白字 */
    }

    .wallpaper-btn:hover::after,
    .music-launcher:hover::after {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 窗口拖拽 */
.meBox.is-detached {
    z-index: 30;
    box-sizing: border-box;
}

.cmd .title,
.music-head {
    user-select: none;
    -webkit-user-select: none;
}

@media (hover: hover) and (pointer: fine) {
    .cmd .title,
.music-head {
        cursor: grab;
        touch-action: none;
    }
}

@media (min-width: 769px) and (hover: hover) and (pointer: fine) {
    .meBox,
    .meBox .headPhoto,
    .meBox .meBox-title {
        cursor: grab;
    }

    .meBox .meBox-text {
        cursor: text;
    }
}

.cmd.dragging .title,
.music-window.dragging .music-head {
    cursor: grabbing;
}

/* 拖拽期间禁用文本选中与原生拖拽 */
html.is-dragging,
html.is-dragging body {
    user-select: none;
    -webkit-user-select: none;
    cursor: grabbing;
}

html.is-dragging .cmd .title,
html.is-dragging .meBox,
html.is-dragging .meBox .headPhoto,
html.is-dragging .meBox .meBox-title {
    cursor: grabbing;
}

html.is-dragging img {
    -webkit-user-drag: none;
    user-drag: none;
    pointer-events: none;
}

#cmdBox .cmd.dragging,
.meBox.dragging {
    z-index: 9999;
}

@media screen and (max-width: 768px) {
    .cmd .click div,
.music-controls button {
        width: 12px;
        height: 12px;
        margin-top: 7px;
    }

    .cmd .click div::before,
.music-controls button::before {
        inset: -12px;
    }

    /* 手机上放大换壁纸 / 音乐按钮，保证手指点得到 */
    .wallpaper-btn,
    .music-launcher {
        padding: 10px 16px;
        font-size: 14px;
    }

    .wallpaper-btn svg,
    .music-launcher svg {
        width: 16px;
        height: 16px;
    }
}

/* 丛雨入口按钮：位于 .corner-stack 内、dock 上方，间距由容器 gap 统一控制 */
.ciallo-btn {
    display: inline-flex;
    flex: none;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.55);
    box-shadow: 0 10px 28px rgba(20, 40, 100, 0.3);
    cursor: pointer;
    pointer-events: auto; /* 父容器关了 pointer-events，这里重新开启 */
    /* 樱花粉渐变，与换壁纸的蓝紫渐变区分，也呼应丛雨主题 */
    background: linear-gradient(135deg, #ff9ec7, #c9a7ff);
    color: #fff;
    font-family: "Fira Code", "Microsoft YaHei", monospace;
    font-size: 13px;
    white-space: nowrap;
    transition: transform 0.12s ease, filter 0.15s ease, background 0.2s ease;
}

.ciallo-btn:active {
    transform: scale(0.96);
}

.ciallo-btn:focus-visible {
    outline: 2px solid #ff7ab8;
    outline-offset: 3px;
}

.ciallo-btn:hover {
    color: #fff;
    filter: brightness(1.06);
}

/* 丛雨对话窗口 */
.murasame-win {
    position: fixed;
    left: max(16px, calc(50vw - 200px));
    top: 10vh;
    width: 400px;
    height: min(560px, 80vh);
    z-index: 960;
    display: flex;
    flex-direction: column;
    border-radius: 18px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 24px 70px rgba(60, 30, 90, 0.35);
    opacity: 0;
    visibility: hidden;
    transform: translateY(14px) scale(0.96);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s linear 0.25s;
}

.murasame-win.open {
    opacity: 1;
    visibility: visible;
    transform: none;
    pointer-events: auto;
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s;
}

.murasame-win.dragging {
    transition: none;
    /* 拖动时置顶，压住其它浮层 */
    z-index: 980;
}

.murasame-head {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 44px;
    padding: 0 14px;
    flex: none;
    background: linear-gradient(90deg, rgba(255, 211, 230, 0.85), rgba(230, 217, 255, 0.85), rgba(211, 236, 255, 0.85));
    user-select: none;
    -webkit-user-select: none;
}

@media (hover: hover) and (pointer: fine) {
    .murasame-head {
        cursor: grab;
        touch-action: none;
    }
}

.murasame-win.dragging .murasame-head {
    cursor: grabbing;
}

.murasame-dot {
    position: relative;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ff7a7a;
    box-shadow: 0 0 5px rgba(255, 122, 122, 0.6);
    cursor: pointer;
    flex: none;
    transition: transform 0.15s ease, background 0.15s ease;
}

.murasame-dot::before {
    content: "";
    position: absolute;
    inset: -10px;
    border-radius: 50%;
}

.murasame-dot::after {
    content: attr(data-tip);
    position: absolute;
    top: 22px;
    left: 50%;
    transform: translateX(-50%) translateY(-4px);
    padding: 5px 8px;
    border-radius: 6px;
    background: rgba(38, 48, 82, 0.94);
    color: #fff;
    font-size: 11px;
    line-height: 1;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

@media (hover: hover) and (pointer: fine) {
    .murasame-dot:hover {
        transform: scale(1.25);
        background: #ff5c5c;
    }

    .murasame-dot:hover::after {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.murasame-title {
    font-size: 14px;
    font-weight: 700;
    color: #7a4a76;
}

.murasame-status {
    margin-left: auto;
    font-size: 11px;
    color: #a06a9c;
    background: rgba(255, 255, 255, 0.6);
    padding: 3px 9px;
    border-radius: 999px;
    white-space: nowrap;
}

.murasame-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 16px 14px;
    background: linear-gradient(180deg, #fff6fb, #f5f8ff);
}

.murasame-body::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

.mmsg {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.mmsg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex: none;
    display: block;
    object-fit: cover;
    object-position: center center;
    background: linear-gradient(135deg, #ff9ec7, #c9a7ff);
    box-shadow: 0 3px 8px rgba(200, 120, 180, 0.4);
}

.mmsg-bubble {
    max-width: 78%;
    padding: 9px 12px;
    border-radius: 4px 14px 14px 14px;
    background: #fff;
    color: #5a4a68;
    font-size: 13px;
    line-height: 1.6;
    box-shadow: 0 3px 10px rgba(120, 80, 140, 0.12);
    white-space: pre-wrap;
    word-break: break-word;
    transition: opacity 0.22s ease, transform 0.22s ease, box-shadow 0.25s ease;
}

.mmsg-images {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 7px;
}

.mmsg-text:empty + .mmsg-images:not(:empty) {
    margin-top: 0;
}

.mmsg-image-link {
    display: block;
    line-height: 0;
}

.mmsg-image {
    display: block;
    width: auto;
    max-width: min(200px, 58vw);
    max-height: 200px;
    border-radius: 12px;
    object-fit: contain;
    background: rgba(255, 255, 255, 0.7);
    box-shadow: 0 5px 16px rgba(78, 57, 104, 0.14);
}

.mmsg-bot .mmsg-bubble.is-sticker-only {
    max-width: calc(100% - 40px);
    padding: 0;
    background: transparent;
    box-shadow: none;
}

/* 丛雨思考中：呼吸光晕与三点逐个跳动 */
.mmsg-bot .mmsg-bubble.is-thinking {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 104px;
    color: #9a7896;
    animation: thinking-glow 1.8s ease-in-out infinite;
}

.mmsg-bot .mmsg-bubble.is-thinking::before {
    content: "思考中";
}

.mmsg-bot .mmsg-bubble.is-thinking::after {
    content: "";
    width: 5px;
    height: 5px;
    margin-left: 1px;
    border-radius: 50%;
    background: #b99be0;
    box-shadow: 9px 0 0 #b99be0, 18px 0 0 #b99be0;
    animation: thinking-dots 1.15s ease-in-out infinite;
}

.mmsg-bubble.reply-in {
    animation: reply-in 0.3s cubic-bezier(0.2, 0.8, 0.3, 1);
}

@keyframes thinking-dots {
    0%,
    70%,
    100% {
        opacity: 0.35;
        transform: translateY(0);
    }

    35% {
        opacity: 1;
        transform: translateY(-2px);
    }
}

@keyframes thinking-glow {
    0%,
    100% {
        box-shadow: 0 3px 10px rgba(120, 80, 140, 0.12);
    }

    50% {
        box-shadow: 0 5px 18px rgba(201, 167, 255, 0.34);
    }
}

@keyframes reply-in {
    from {
        opacity: 0.35;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .mmsg-bot .mmsg-bubble.is-thinking,
    .mmsg-bot .mmsg-bubble.is-thinking::after,
    .mmsg-bubble.reply-in {
        animation: none;
    }
}

/* 用户消息：靠右、粉紫渐变气泡、无头像 */
.mmsg-user {
    justify-content: flex-end;
}

.mmsg-user .mmsg-bubble {
    background: linear-gradient(135deg, #ff9ec7, #c9a7ff);
    color: #fff;
    border-radius: 14px 4px 14px 14px;
    box-shadow: 0 3px 10px rgba(200, 120, 180, 0.35);
}

.murasame-input {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    flex: none;
    background: #fff;
    border-top: 1px solid #f3e0ee;
}

.murasame-input input {
    flex: 1;
    height: 36px;
    border-radius: 999px;
    border: 1px solid #eccfe2;
    padding: 0 14px;
    font-size: 13px;
    color: #6a5570;
    background: #fdf6fb;
    outline: none;
}

.murasame-input input:disabled {
    cursor: not-allowed;
    color: #b9a5b5;
}

.murasame-input button {
    flex: none;
    height: 36px;
    padding: 0 18px;
    border: none;
    border-radius: 999px;
    background: linear-gradient(135deg, #ff9ec7, #c9a7ff);
    color: #fff;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    transition: opacity 0.2s;
}

.murasame-input button:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.murasame-input .murasame-meme-btn {
    flex: none;
    min-width: 56px;
    padding: 0 12px;
    color: #785f8d;
    border: 1px solid #e8cee2;
    background: #fff7fc;
    white-space: nowrap;
}

.murasame-input .murasame-meme-btn:hover {
    color: #5c4672;
    background: #ffeefa;
}

/* 手机端：对话窗口近乎全屏 */
@media screen and (max-width: 768px) {
    .ciallo-btn {
        font-size: 12px;
        padding: 7px 14px;
    }

    .murasame-win {
        left: 12px;
        right: 12px;
        width: auto;
        top: 7vh;
        height: 70vh;
    }
}
