/* 天梯首页 — 沉浸式关卡大厅 */

:root {
    --sg-bg: #03072f;
    --sg-ink: #e8fbff;
    --sg-cyan: #87fefe;
    --sg-cyan-2: #bdfbff;
    --sg-gold: #f5ff7f;
    --sg-panel: rgba(5, 28, 68, 0.72);
    --sg-line: rgba(135, 254, 254, 0.22);
    --sg-soft: rgba(189, 251, 255, 0.08);
    --sg-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body.sg-body {
    margin: 0;
    padding: 0;
    width: 100%;
    max-width: 100%;
    min-height: 100%;
    overflow-x: hidden;
    background: var(--sg-bg);
    color: var(--sg-ink);
    font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.sg-page {
    position: relative;
    width: 100%;
    max-width: 100%;
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
    background:
        radial-gradient(900px 420px at 18% 12%, rgba(37, 99, 235, 0.22), transparent 60%),
        radial-gradient(700px 360px at 72% 20%, rgba(14, 165, 233, 0.14), transparent 55%),
        #03072f url(/uploads/stage/bg2.jpg) no-repeat 55% bottom / cover;
    background-position-y: 100%;
    transition: background-position-y 0.35s ease;
}

.sg-page::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, rgba(3, 7, 47, 0.72) 0%, rgba(3, 7, 47, 0.42) 22%, rgba(3, 7, 47, 0.08) 48%, rgba(3, 7, 47, 0.18) 72%, rgba(3, 7, 47, 0.55) 100%),
        linear-gradient(180deg, rgba(3, 7, 47, 0.4) 0%, transparent 16%, transparent 70%, rgba(3, 7, 47, 0.5) 100%);
    pointer-events: none;
}

.sg-top,
.sg-main {
    position: relative;
    z-index: 1;
}

.sg-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    max-width: 1440px;
    margin: 0 auto;
    padding: 18px 24px 8px;
}

.sg-top img {
    max-width: 40px;
    max-height: 40px;
}

.sg-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #fff !important;
    text-decoration: none !important;
    font-size: 18px;
    font-weight: 450;
    letter-spacing: 0.02em;
    flex: 0 0 auto;
    max-width: max-content;
}

.sg-brand-mark,
.sg-brand img.sg-brand-mark {
    display: block !important;
    width: 34px !important;
    height: 34px !important;
    max-width: 34px !important;
    max-height: 34px !important;
    border-radius: 9px;
    object-fit: contain;
    flex: 0 0 34px;
}

.sg-avatar img {
    max-width: 32px !important;
    max-height: 32px !important;
}

.sg-top-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.sg-user {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 40px;
    padding: 4px 14px 4px 4px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(5, 41, 83, 0.9), rgba(5, 41, 83, 0.2));
    border: 1px solid rgba(189, 251, 255, 0.28);
}

.sg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    border: 1px solid rgba(189, 251, 255, 0.55);
    background: #052953;
}

.sg-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.sg-nick {
    max-width: 9em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--sg-cyan-2);
    font-size: 13px;
    font-weight: 400;
}

.sg-food {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 14px 0 8px;
    border-radius: 999px;
    background: rgba(5, 41, 83, 0.54);
    border: 1px solid rgba(189, 251, 255, 0.35);
    color: var(--sg-cyan-2);
    font-size: 14px;
    font-weight: 450;
}

.sg-food-ico {
    width: 28px;
    height: 26px;
    background: url(/uploads/stage/reward.png) center / contain no-repeat;
}

.sg-link {
    display: inline-flex;
    align-items: center;
    height: 36px;
    padding: 0 14px;
    border-radius: 999px;
    color: var(--sg-cyan-2) !important;
    text-decoration: none !important;
    font-size: 13px;
    font-weight: 400;
    border: 1px solid transparent;
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.sg-link:hover {
    color: #fff !important;
    border-color: rgba(135, 254, 254, 0.35);
    background: rgba(135, 254, 254, 0.08);
}

.sg-main {
    display: grid;
    grid-template-columns: minmax(0, 280px) minmax(0, 1fr);
    gap: 20px;
    align-items: stretch;
    max-width: 1440px;
    margin: 0 auto;
    padding: 8px 24px 20px;
    height: calc(100vh - 76px);
    max-height: calc(100vh - 76px);
    min-height: 0;
    overflow: hidden;
    position: relative;
}

/* ---- list ---- */
.sg-rail {
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
    max-height: 100%;
    overflow: hidden;
    padding: 18px 12px 12px 8px;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(5, 28, 68, 0.48), rgba(5, 28, 68, 0.22));
    border: 1px solid rgba(135, 254, 254, 0.12);
    backdrop-filter: blur(10px);
    animation: sg-rise 0.65s var(--sg-ease) both;
}

.sg-rail-head {
    padding: 0 10px 14px;
}

.sg-rail-kicker,
.sg-panel-kicker {
    margin: 0 0 6px;
    font-size: 11px;
    font-weight: 450;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: rgba(135, 254, 254, 0.72);
}

.sg-rail-head h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 450;
    color: #fff;
}

.sg-rail-hint {
    margin: 8px 0 0;
    font-size: 12px;
    line-height: 1.4;
    color: rgba(189, 251, 255, 0.55);
}

.sg-list {
    list-style: none;
    margin: 0;
    padding: 8px 6px 16px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    flex: 1 1 auto;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(135, 254, 254, 0.35) transparent;
    -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 92%, transparent);
    mask-image: linear-gradient(180deg, #000 0%, #000 92%, transparent);
}

.sg-list::-webkit-scrollbar {
    width: 4px;
}

.sg-list::-webkit-scrollbar-thumb {
    background: rgba(135, 254, 254, 0.35);
    border-radius: 4px;
}

.sg-item {
    position: relative;
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr) 18px;
    align-items: center;
    gap: 8px;
    min-height: 52px;
    margin-bottom: 10px;
    padding: 8px 12px 8px 6px;
    border-radius: 12px;
    background: rgba(7, 36, 82, 0.55);
    border: 1px solid rgba(189, 251, 255, 0.12);
    cursor: pointer;
    transition: transform 0.2s var(--sg-ease), background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.sg-item:hover {
    transform: translateX(3px);
    border-color: rgba(135, 254, 254, 0.35);
    background: rgba(12, 52, 110, 0.7);
}

.sg-item.is-active {
    background:
        linear-gradient(90deg, rgba(245, 255, 127, 0.14), rgba(12, 52, 110, 0.75) 42%),
        rgba(12, 52, 110, 0.8);
    border-color: rgba(245, 255, 127, 0.45);
    box-shadow: 0 10px 28px -18px rgba(245, 255, 127, 0.55);
}

.sg-item-no {
    font-size: 20px;
    font-weight: 450;
    letter-spacing: 0.02em;
    text-align: center;
    color: var(--sg-cyan-2);
    font-variant-numeric: tabular-nums;
}

.sg-item.is-active .sg-item-no {
    color: var(--sg-gold);
}

.sg-item-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
    font-weight: 450;
    color: var(--sg-cyan-2);
}

.sg-item.is-active .sg-item-name {
    color: #fff;
}

.sg-item-arrow {
    width: 10px;
    height: 10px;
    border-right: 2px solid transparent;
    border-bottom: 2px solid transparent;
    transform: rotate(-45deg);
    opacity: 0;
}

.sg-item.is-active .sg-item-arrow {
    border-color: var(--sg-gold);
    opacity: 1;
    animation: sg-nudge 0.9s ease infinite;
}

/* ---- tower ---- */
.sg-tower-pane {
    display: flex;
    align-items: stretch;
    justify-content: center;
    min-width: 0;
    min-height: 0;
    height: 100%;
    overflow: hidden;
    /* 右侧留给固定信息面板，避免再撑出横向滚动 */
    padding-right: 0;
    margin-right: min(400px, 32%);
    animation: sg-rise 0.7s var(--sg-ease) 0.05s both;
}

.sg-tower-frame {
    position: relative;
    width: min(100%, 480px);
    height: 100%;
    max-height: 100%;
    overflow: hidden;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    /* 只柔化左右，不再裁掉塔顶光束 */
    -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 8%, #000 92%, transparent 100%);
    mask-image: linear-gradient(90deg, transparent 0%, #000 8%, #000 92%, transparent 100%);
}

.sg-tower-frame::after {
    content: none;
}

.sg-tower {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 100%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.4s var(--sg-ease);
    will-change: transform;
}

.sg-tower-img {
    display: block;
    width: auto;
    height: 100%;
    max-width: 100%;
    object-fit: contain;
    object-position: center center;
    filter:
        drop-shadow(0 18px 36px rgba(0, 0, 0, 0.28))
        saturate(1.08)
        contrast(1.04)
        brightness(1.08);
}

.sg-fx {
    position: absolute;
    pointer-events: none;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    opacity: 0.4;
    z-index: 1;
}

.sg-fx-1 {
    width: 36%;
    height: 42%;
    left: 8%;
    bottom: 18%;
    background-image: url(/uploads/stage/crash_1.png);
    animation: sg-bob 4s ease-in-out infinite;
}

.sg-fx-2 {
    width: 30%;
    height: 36%;
    right: 6%;
    bottom: 12%;
    left: auto;
    background-image: url(/uploads/stage/crash_2.png);
    animation: sg-bob 3s ease-in-out infinite;
}

.sg-fx-3 {
    display: none;
}

.sg-fx-4 {
    width: 18%;
    height: 28%;
    left: 46%;
    bottom: 48%;
    background-image: url(/uploads/stage/crash_4.png);
    animation: sg-lift 2.4s linear infinite;
    opacity: 0.5;
}

/* ---- info panel ---- */
.sg-panel {
    position: fixed;
    top: 96px;
    right: 16px;
    bottom: 16px;
    z-index: 50;
    width: 360px;
    max-width: calc(100vw - 32px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 0;
    margin: 0;
    opacity: 1 !important;
    transform: none !important;
    animation: none;
    overflow-x: hidden;
    overflow-y: auto;
}

.sg-title {
    margin: 0 0 18px;
    font-size: clamp(26px, 2.6vw, 34px);
    font-weight: 450;
    letter-spacing: -0.02em;
    line-height: 1.25;
    color: var(--sg-cyan);
    text-shadow: 0 0 24px rgba(135, 254, 254, 0.25);
}

.sg-card {
    padding: 22px 22px 18px;
    border-radius: 18px;
    background:
        linear-gradient(180deg, rgba(8, 42, 96, 0.78), rgba(5, 28, 68, 0.82)),
        url(/uploads/stage/p_bg_2.png) center / 100% 100% no-repeat;
    border: 1px solid rgba(135, 254, 254, 0.2);
    box-shadow: 0 18px 40px -28px rgba(0, 0, 0, 0.7);
}

.sg-row {
    display: grid;
    grid-template-columns: 5.5em minmax(0, 1fr);
    gap: 10px 12px;
    margin-bottom: 14px;
    color: var(--sg-cyan-2);
    font-size: 14px;
    line-height: 1.65;
}

.sg-row em {
    font-style: normal;
    font-weight: 450;
    color: #fff;
}

.sg-row p {
    margin: 0;
    word-break: break-word;
}

.sg-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 6px;
}

.sg-stat {
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(3, 16, 42, 0.45);
    border: 1px solid rgba(135, 254, 254, 0.14);
}

.sg-stat em {
    display: block;
    margin-bottom: 6px;
    font-style: normal;
    font-size: 12px;
    font-weight: 400;
    color: rgba(189, 251, 255, 0.72);
}

.sg-stat strong {
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
    font-size: 20px;
    font-weight: 450;
    color: #fff;
    letter-spacing: -0.02em;
}

.sg-stat small {
    font-size: 12px;
    font-weight: 400;
    color: rgba(189, 251, 255, 0.7);
}

.sg-stat-reward {
    color: var(--sg-gold) !important;
}

.sg-start {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 56px;
    margin-top: 18px;
    border: 0;
    border-radius: 14px;
    background: linear-gradient(180deg, #3b82f6 0%, #1d4ed8 100%);
    box-shadow:
        0 12px 28px -14px rgba(37, 99, 235, 0.8),
        0 0 0 1px rgba(135, 254, 254, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
    color: #fff;
    font-size: 18px;
    font-weight: 450;
    letter-spacing: 0.12em;
    cursor: pointer;
    transition: transform 0.2s var(--sg-ease), filter 0.2s ease;
}

.sg-start:hover:not(:disabled) {
    transform: translateY(-2px) scale(1.01);
    filter: brightness(1.06);
}

.sg-start:disabled,
.sg-start.disabled {
    cursor: not-allowed;
    filter: grayscale(0.35) brightness(0.75);
    box-shadow: none;
}

.sg-start-hint {
    margin: 10px 0 0;
    text-align: center;
    font-size: 12px;
    color: rgba(189, 251, 255, 0.55);
}

@keyframes sg-rise {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes sg-nudge {
    0%, 100% { transform: rotate(-45deg) translate(0, 0); }
    50% { transform: rotate(-45deg) translate(2px, 2px); }
}

@keyframes sg-bob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(8px); }
}

@keyframes sg-lift {
    0% { transform: translateY(0); opacity: 1; }
    100% { transform: translateY(-70px); opacity: 0; }
}

/* ---- rank drawer ---- */
.sg-rank-mask {
    position: fixed;
    inset: 0;
    z-index: 1200;
    background: rgba(1, 6, 24, 0.58);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.16s ease, visibility 0.16s ease;
}

.sg-rank-drawer {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 1210;
    display: flex;
    flex-direction: column;
    width: min(440px, 100vw);
    height: 100vh;
    padding: 22px 18px 18px;
    background: #071833;
    border-left: 1px solid rgba(135, 254, 254, 0.22);
    box-shadow: -12px 0 32px rgba(0, 0, 0, 0.28);
    color: var(--sg-ink);
    transform: translate3d(100%, 0, 0);
    visibility: hidden;
    pointer-events: none;
    will-change: transform;
    transition: transform 0.18s ease, visibility 0.18s ease;
    contain: layout paint;
}

.sg-rank-mask.is-open,
.sg-rank-drawer.is-open {
    visibility: visible;
    pointer-events: auto;
}

.sg-rank-mask.is-open {
    opacity: 1;
}

.sg-rank-drawer.is-open {
    transform: translate3d(0, 0, 0);
}

.sg-page.is-rank-open .sg-fx,
.sg-page.is-rank-open .sg-tower-img {
    animation-play-state: paused !important;
}

.sg-rank-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.sg-rank-kicker {
    margin: 0 0 4px;
    color: var(--sg-cyan);
    font-size: 11px;
    letter-spacing: 0.16em;
    font-weight: 450;
}

.sg-rank-head h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 450;
    letter-spacing: 0.04em;
    color: #fff;
}

.sg-rank-rule {
    margin: 6px 0 0;
    color: rgba(189, 251, 255, 0.62);
    font-size: 12px;
}

.sg-rank-close {
    width: 36px;
    height: 36px;
    border: 1px solid rgba(135, 254, 254, 0.28);
    border-radius: 10px;
    background: rgba(135, 254, 254, 0.06);
    color: var(--sg-cyan-2);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.sg-rank-close:hover {
    background: rgba(135, 254, 254, 0.14);
    color: #fff;
}

.sg-rank-me {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid rgba(245, 255, 127, 0.28);
    background: linear-gradient(90deg, rgba(245, 255, 127, 0.1), rgba(56, 189, 248, 0.06));
}

.sg-rank-me .sg-rank-badge {
    min-width: 2.4em;
    color: var(--sg-gold);
    font-size: 18px;
    font-weight: 450;
    text-align: center;
}

.sg-rank-me .sg-rank-meta {
    min-width: 0;
    flex: 1;
}

.sg-rank-me .sg-rank-meta strong {
    display: block;
    color: #fff;
    font-size: 14px;
}

.sg-rank-me .sg-rank-meta span {
    color: rgba(189, 251, 255, 0.72);
    font-size: 12px;
}

.sg-rank-table-wrap {
    position: relative;
    flex: 1;
    min-height: 0;
    overflow: auto;
    border-radius: 14px;
    border: 1px solid rgba(135, 254, 254, 0.16);
    background: rgba(2, 14, 40, 0.45);
}

.sg-rank-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.sg-rank-table th,
.sg-rank-table td {
    padding: 11px 10px;
    text-align: left;
    border-bottom: 1px solid rgba(135, 254, 254, 0.1);
    vertical-align: middle;
}

.sg-rank-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: rgba(6, 24, 58, 0.96);
    color: rgba(189, 251, 255, 0.7);
    font-size: 12px;
    font-weight: 400;
}

.sg-rank-table .col-r { width: 52px; text-align: center; }
.sg-rank-table .col-c { width: 58px; text-align: center; }
.sg-rank-table .col-f { width: 58px; text-align: center; }
.sg-rank-table .col-s { width: 88px; }

.sg-rank-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.6em;
    font-weight: 450;
    color: var(--sg-cyan-2);
}

.sg-rank-num.is-top1 { color: #f5d76e; }
.sg-rank-num.is-top2 { color: #d7e3ef; }
.sg-rank-num.is-top3 { color: #e0a070; }

.sg-rank-user {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    max-width: 160px;
}

.sg-rank-user img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(189, 251, 255, 0.4);
    background: #052953;
    flex: 0 0 28px;
}

.sg-rank-user span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #fff;
    font-weight: 400;
}

.sg-rank-table td.col-c,
.sg-rank-table td.col-f {
    color: var(--sg-cyan);
    font-weight: 450;
    text-align: center;
}

.sg-rank-table td.col-s {
    color: rgba(232, 251, 255, 0.82);
    font-size: 12px;
}

.sg-rank-empty {
    margin: 48px 20px;
    text-align: center;
    color: rgba(189, 251, 255, 0.55);
    font-size: 14px;
    line-height: 1.6;
}

.sg-rank-table.is-empty {
    display: none;
}

@media (max-width: 1100px) {
    .sg-main {
        grid-template-columns: minmax(0, 240px) minmax(0, 1fr);
        gap: 14px;
        padding: 8px 16px 16px;
    }

    .sg-tower-pane {
        padding-right: 0;
        margin-right: min(340px, 34%);
    }

    .sg-tower-frame {
        width: min(100%, 420px);
    }

    .sg-panel {
        right: 12px;
        width: 320px;
    }
}

@media (max-width: 900px) {
    .sg-page {
        height: auto;
        max-height: none;
        overflow-x: hidden;
        overflow-y: auto;
    }

    .sg-top {
        padding: 14px 14px 6px;
    }

    .sg-main {
        grid-template-columns: 1fr;
        height: auto;
        max-height: none;
        overflow: visible;
        min-height: 0;
        padding: 8px 14px 28px;
    }

    .sg-tower-pane {
        order: -1;
        padding-right: 0;
        margin-right: 0;
        height: auto;
    }

    .sg-tower-frame {
        width: 100%;
        height: 38vh;
        min-height: 240px;
        max-height: 320px;
        -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 6%, #000 94%, transparent 100%);
        mask-image: linear-gradient(90deg, transparent 0%, #000 6%, #000 94%, transparent 100%);
    }

    .sg-tower {
        width: 100%;
    }

    .sg-panel {
        position: relative !important;
        top: auto !important;
        right: auto !important;
        bottom: auto !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
        margin-top: 8px;
        overflow: visible;
    }

    .sg-rail {
        max-height: 280px;
        height: 280px;
    }

    .sg-list {
        display: flex;
        gap: 10px;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-mask-image: none;
        mask-image: none;
        padding-bottom: 6px;
    }

    .sg-item {
        flex: 0 0 200px;
        margin-bottom: 0;
        grid-template-columns: 44px minmax(0, 1fr) 14px;
    }

    .sg-stats {
        grid-template-columns: 1fr 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    .sg-rail,
    .sg-tower-pane,
    .sg-panel,
    .sg-fx-1,
    .sg-fx-2,
    .sg-fx-3,
    .sg-fx-4,
    .sg-item.is-active .sg-item-arrow,
    .sg-guide-copy,
    .sg-guide-visual,
    .sg-guide-hero-art,
    .sg-guide-orbit,
    .sg-guide-glow,
    .sg-guide-spark-a,
    .sg-guide-spark-b,
    .sg-guide-bg {
        animation: none !important;
    }
}

/* ---- guide 剧情页 ---- */
body.sg-guide-body {
    overflow: hidden;
}

.sg-guide {
    position: relative;
    width: 100%;
    min-height: 100vh;
    overflow: hidden;
    color: var(--sg-ink);
}

.sg-guide-bg {
    position: absolute;
    inset: 0;
    background: #0a0618 url(/uploads/stage/bg1.jpg) 62% center / cover no-repeat;
    transform: scale(1.06);
    animation: sg-guide-ken 18s ease-in-out infinite alternate;
}

.sg-guide-veil {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(100deg, rgba(3, 7, 47, 0.9) 0%, rgba(3, 7, 47, 0.78) 34%, rgba(3, 7, 47, 0.28) 58%, rgba(3, 7, 47, 0.12) 78%, rgba(8, 4, 28, 0.35) 100%),
        linear-gradient(180deg, rgba(3, 7, 47, 0.4) 0%, transparent 18%, transparent 72%, rgba(3, 7, 47, 0.55) 100%);
    pointer-events: none;
}

.sg-guide-glow {
    position: absolute;
    width: 48vw;
    height: 48vw;
    right: -8%;
    top: 10%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.22), transparent 68%);
    pointer-events: none;
    animation: sg-guide-pulse 6s ease-in-out infinite;
}

.sg-guide-top {
    position: relative;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    max-width: 1240px;
    margin: 0 auto;
    padding: 20px 28px 0;
}

.sg-guide-top-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.sg-guide-main {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    align-items: center;
    gap: 24px 40px;
    max-width: 1240px;
    margin: 0 auto;
    padding: 36px 28px 48px;
    min-height: calc(100vh - 72px);
}

.sg-guide-copy {
    max-width: 560px;
    animation: sg-rise 0.8s var(--sg-ease) both;
}

.sg-guide-kicker {
    margin: 0 0 10px;
    font-size: 12px;
    font-weight: 450;
    letter-spacing: 0.22em;
    color: rgba(135, 254, 254, 0.7);
}

.sg-guide-title {
    margin: 0 0 22px;
    font-size: clamp(32px, 4.2vw, 48px);
    font-weight: 450;
    letter-spacing: -0.03em;
    line-height: 1.15;
    color: #fff;
    text-shadow: 0 0 36px rgba(135, 254, 254, 0.28);
}

.sg-guide-story p {
    margin: 0 0 16px;
    font-size: clamp(15px, 1.35vw, 17px);
    line-height: 1.85;
    color: rgba(232, 251, 255, 0.88);
}

.sg-guide-story p:last-child {
    margin-bottom: 0;
}

.sg-guide-climax {
    margin-top: 8px !important;
    font-size: clamp(17px, 1.6vw, 20px) !important;
    font-weight: 450;
    color: var(--sg-cyan) !important;
    letter-spacing: 0.02em;
}

.sg-guide-cta {
    margin-top: 28px;
}

.sg-guide-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 220px;
    height: 56px;
    padding: 0 28px;
    border-radius: 14px;
    background: linear-gradient(180deg, #3b82f6 0%, #1d4ed8 100%);
    box-shadow:
        0 14px 32px -14px rgba(37, 99, 235, 0.85),
        0 0 0 1px rgba(135, 254, 254, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.22);
    color: #fff !important;
    text-decoration: none !important;
    font-size: 17px;
    font-weight: 450;
    letter-spacing: 0.14em;
    transition: transform 0.22s var(--sg-ease), filter 0.22s ease;
}

.sg-guide-btn:hover {
    transform: translateY(-2px) scale(1.02);
    filter: brightness(1.06);
}

.sg-guide-hint {
    margin: 12px 0 0;
    font-size: 12px;
    color: rgba(189, 251, 255, 0.48);
}

.sg-guide-visual {
    position: relative;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    align-self: stretch;
    min-height: min(68vh, 620px);
    margin-right: -12px;
    animation: sg-rise 0.9s var(--sg-ease) 0.08s both;
}

.sg-guide-orbit {
    position: absolute;
    width: min(92%, 480px);
    aspect-ratio: 1;
    top: 4%;
    border-radius: 50%;
    border: 1px solid rgba(135, 254, 254, 0.12);
    box-shadow:
        0 0 0 28px rgba(135, 254, 254, 0.02),
        inset 0 0 70px rgba(56, 189, 248, 0.06);
    animation: sg-guide-spin 36s linear infinite;
    opacity: 0.7;
}

.sg-guide-orbit::before {
    content: "";
    position: absolute;
    inset: 16%;
    border-radius: 50%;
    border: 1px dashed rgba(189, 251, 255, 0.12);
}

.sg-guide-hero-art {
    position: relative;
    z-index: 1;
    display: block;
    width: min(100%, 420px);
    height: auto;
    max-height: min(72vh, 640px);
    object-fit: contain;
    object-position: center bottom;
    filter:
        drop-shadow(0 30px 50px rgba(0, 0, 0, 0.45))
        saturate(1.1)
        contrast(1.04)
        brightness(1.08);
    -webkit-mask-image: radial-gradient(ellipse 78% 88% at 50% 48%, #000 48%, transparent 82%);
    mask-image: radial-gradient(ellipse 78% 88% at 50% 48%, #000 48%, transparent 82%);
    animation: sg-guide-float 4.8s ease-in-out infinite;
}

.sg-guide-spark {
    position: absolute;
    z-index: 2;
    pointer-events: none;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    opacity: 0.7;
}

.sg-guide-spark-a {
    width: 28%;
    height: 36%;
    left: 40%;
    bottom: 42%;
    background-image: url(/uploads/stage/crash_4.png);
    animation: sg-lift 2.4s linear infinite;
}

.sg-guide-spark-b {
    width: 42%;
    height: 48%;
    left: 22%;
    bottom: 10%;
    background-image: url(/uploads/stage/crash_1.png);
    animation: sg-bob 3.6s ease-in-out infinite;
}

@keyframes sg-guide-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes sg-guide-ken {
    from { transform: scale(1.04) translate(0, 0); }
    to { transform: scale(1.1) translate(-1.5%, 1%); }
}

@keyframes sg-guide-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes sg-guide-pulse {
    0%, 100% { opacity: 0.45; }
    50% { opacity: 0.85; }
}

@media (max-width: 960px) {
    body.sg-guide-body {
        overflow: auto;
    }

    .sg-guide {
        min-height: 100vh;
        overflow: auto;
    }

    .sg-guide-main {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 20px 18px 40px;
        min-height: 0;
    }

    .sg-guide-visual {
        order: -1;
        min-height: 260px;
        margin-right: 0;
    }

    .sg-guide-hero-art {
        width: min(72%, 300px);
        max-height: 260px;
    }

    .sg-guide-copy {
        max-width: none;
    }

    .sg-guide-btn {
        width: 100%;
    }
}


/* ---- challenge 挑战页 ---- */
body.sg-ch-body {
    overflow: hidden;
}

.sg-ch {
    position: relative;
    width: 100%;
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
    color: var(--sg-ink);
    display: flex;
    flex-direction: column;
}

.sg-ch-bg {
    position: absolute;
    inset: 0;
    background: #03072f url(/uploads/stage/bg3.jpg) center / cover no-repeat;
    transform: scale(1.03);
}

.sg-ch-veil {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(3, 7, 47, 0.72) 0%, rgba(3, 7, 47, 0.55) 40%, rgba(3, 7, 47, 0.78) 100%),
        radial-gradient(900px 420px at 70% 0%, rgba(37, 99, 235, 0.2), transparent 60%);
    pointer-events: none;
}

.sg-ch-top,
.sg-ch-main,
.sg-ch-bottom {
    position: relative;
    z-index: 2;
}

.sg-ch-top {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 12px;
    padding: 14px 20px 8px;
    max-width: 1440px;
    width: 100%;
    margin: 0 auto;
}

.sg-ch-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    justify-self: start;
    height: 40px;
    padding: 0 14px 0 10px;
    border-radius: 999px;
    border: 1px solid rgba(135, 254, 254, 0.28);
    background: rgba(5, 28, 68, 0.55);
    color: var(--sg-cyan-2) !important;
    text-decoration: none !important;
    font-size: 13px;
    font-weight: 450;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.sg-ch-back:hover {
    background: rgba(12, 52, 110, 0.7);
    border-color: rgba(135, 254, 254, 0.5);
    color: #fff !important;
}

.sg-ch-back-ico {
    width: 8px;
    height: 8px;
    border-left: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    margin-left: 4px;
}

.sg-ch-timer {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 148px;
    padding: 8px 22px;
    border-radius: 16px;
    background:
        radial-gradient(120% 100% at 50% 0%, rgba(56, 189, 248, 0.22), transparent 60%),
        rgba(5, 28, 68, 0.72);
    border: 1px solid rgba(135, 254, 254, 0.35);
    box-shadow: 0 12px 28px -18px rgba(56, 189, 248, 0.7);
}

.sg-ch-timer-label {
    font-size: 11px;
    font-weight: 450;
    letter-spacing: 0.12em;
    color: rgba(189, 251, 255, 0.7);
}

.sg-ch-timer-val {
    margin-top: 2px;
    font-size: 28px;
    font-weight: 450;
    letter-spacing: 0.04em;
    color: var(--sg-cyan);
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}

.sg-ch-timer.is-urgent {
    border-color: rgba(251, 113, 133, 0.55);
}

.sg-ch-timer.is-urgent .sg-ch-timer-val {
    color: #fda4af;
}

.sg-ch-stage {
    justify-self: end;
    text-align: right;
}

.sg-ch-stage-kicker,
.sg-ch-kicker,
.sg-ch-nav-label {
    margin: 0 0 4px;
    font-size: 11px;
    font-weight: 450;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(135, 254, 254, 0.65);
}

.sg-ch-stage strong {
    font-size: 15px;
    font-weight: 450;
    color: #fff;
}

.sg-ch-main {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr) minmax(340px, 1.05fr);
    gap: 12px;
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
    padding: 8px 16px 12px;
}

.sg-ch-nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 14px 8px;
    border-radius: 18px;
    background: rgba(5, 28, 68, 0.42);
    border: 1px solid rgba(135, 254, 254, 0.12);
    overflow: auto;
}

.sg-ch-nav-label {
    writing-mode: horizontal-tb;
}

.sg-ch-nav-item {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    border: 1px solid rgba(189, 251, 255, 0.18);
    background: rgba(7, 36, 82, 0.65);
    color: var(--sg-cyan-2);
    font-size: 16px;
    font-weight: 450;
    cursor: pointer;
    transition: transform 0.2s var(--sg-ease), border-color 0.2s ease, background 0.2s ease;
}

.sg-ch-nav-item:hover {
    transform: translateY(-1px);
    border-color: rgba(135, 254, 254, 0.45);
}

.sg-ch-nav-item.is-active {
    background: linear-gradient(180deg, rgba(245, 255, 127, 0.2), rgba(12, 52, 110, 0.85));
    border-color: rgba(245, 255, 127, 0.55);
    color: var(--sg-gold);
    box-shadow: 0 10px 22px -16px rgba(245, 255, 127, 0.7);
}

.sg-ch-board {
    min-width: 0;
    min-height: 0;
    border-radius: 20px;
    border: 1px solid rgba(135, 254, 254, 0.16);
    background: linear-gradient(180deg, rgba(5, 28, 68, 0.62), rgba(5, 20, 52, 0.78));
    box-shadow: 0 18px 40px -28px rgba(0, 0, 0, 0.75);
    overflow: hidden;
}

.sg-ch-panel {
    height: 100%;
    overflow: auto;
    padding: 22px 24px 28px;
    scrollbar-width: thin;
    scrollbar-color: rgba(135, 254, 254, 0.35) transparent;
}

.sg-ch-q {
    display: none;
    animation: sg-rise 0.45s var(--sg-ease) both;
}

.sg-ch-q.is-active {
    display: block;
}

.sg-ch-q-head {
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(135, 254, 254, 0.12);
}

.sg-ch-q-title {
    margin: 0 0 10px;
    font-size: clamp(22px, 2.2vw, 28px);
    font-weight: 450;
    letter-spacing: -0.02em;
    color: #fff;
    line-height: 1.3;
}

.sg-ch-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.sg-ch-tag {
    display: inline-flex;
    align-items: center;
    height: 26px;
    padding: 0 10px;
    border-radius: 6px;
    background: rgba(59, 130, 246, 0.22);
    border: 1px solid rgba(135, 254, 254, 0.28);
    color: var(--sg-cyan-2);
    font-size: 12px;
    font-weight: 450;
}

.sg-ch-tag-soft {
    background: rgba(245, 255, 127, 0.1);
    border-color: rgba(245, 255, 127, 0.28);
    color: var(--sg-gold);
}

.sg-ch-block {
    margin-bottom: 20px;
}

.sg-ch-block h2 {
    margin: 0 0 10px;
    font-size: 14px;
    font-weight: 450;
    letter-spacing: 0.06em;
    color: var(--sg-cyan);
}

.sg-ch-md {
    font-size: 15px;
    line-height: 1.85;
    color: rgba(232, 251, 255, 0.9);
    word-break: break-word;
}

.sg-ch-md code {
    padding: 1px 6px;
    border-radius: 4px;
    background: rgba(3, 16, 42, 0.65);
    border: 1px solid rgba(135, 254, 254, 0.16);
    color: var(--sg-cyan-2);
    font-size: 0.92em;
}

.sg-ch-md pre {
    margin: 10px 0;
    padding: 12px 14px;
    border-radius: 10px;
    background: rgba(3, 16, 42, 0.7);
    border: 1px solid rgba(135, 254, 254, 0.14);
    overflow: auto;
    color: #e8fbff;
}

.sg-ch-md h2,
.sg-ch-md h3,
.sg-ch-md h4 {
    color: #fff;
    margin: 14px 0 8px;
}

.sg-ch-samples {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sg-ch-sample {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.sg-ch-io {
    min-width: 0;
    border-radius: 12px;
    border: 1px solid rgba(135, 254, 254, 0.18);
    background: rgba(3, 16, 42, 0.55);
    overflow: hidden;
}

.sg-ch-io-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid rgba(135, 254, 254, 0.1);
    font-size: 12px;
    font-weight: 450;
    color: rgba(189, 251, 255, 0.8);
}

.sg-ch-copy {
    border: 0;
    background: transparent;
    color: var(--sg-cyan);
    font-size: 12px;
    font-weight: 450;
    cursor: pointer;
    padding: 0;
}

.sg-ch-copy:hover {
    color: #fff;
}

.sg-ch-io pre {
    margin: 0;
    padding: 12px;
    min-height: 72px;
    max-height: 180px;
    overflow: auto;
    font-size: 13px;
    line-height: 1.55;
    color: #e8fbff;
    white-space: pre-wrap;
    word-break: break-word;
}

.sg-ch-q-foot {
    margin-top: 8px;
    padding-top: 16px;
    border-top: 1px solid rgba(135, 254, 254, 0.1);
}

/* workspace editor */
.sg-ch-workspace {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    border-radius: 18px;
    border: 1px solid rgba(135, 254, 254, 0.16);
    background: linear-gradient(180deg, rgba(8, 18, 48, 0.92), rgba(4, 12, 36, 0.96));
    box-shadow: 0 18px 40px -28px rgba(0, 0, 0, 0.75);
    overflow: hidden;
}

.sg-ch-workspace.is-focus {
    position: fixed;
    inset: 12px;
    z-index: 80;
    border-radius: 16px;
}

html.sg-ch-focus .sg-ch-top,
html.sg-ch-focus .sg-ch-nav,
html.sg-ch-focus .sg-ch-board,
html.sg-ch-focus .sg-ch-bottom {
    visibility: hidden;
}

.sg-ch-ed-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(135, 254, 254, 0.12);
    background: rgba(5, 28, 68, 0.45);
    flex: 0 0 auto;
}

.sg-ch-lang {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 450;
    color: rgba(189, 251, 255, 0.72);
}

.sg-ch-lang select {
    height: 32px;
    padding: 0 10px;
    border-radius: 8px;
    border: 1px solid rgba(135, 254, 254, 0.28);
    background: rgba(3, 16, 42, 0.85);
    color: #e8fbff;
    font-size: 13px;
    font-weight: 450;
    outline: none;
}

.sg-ch-ed-tools,
.sg-ch-console-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.sg-ch-icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid rgba(135, 254, 254, 0.2);
    background: rgba(3, 16, 42, 0.55);
    color: var(--sg-cyan-2);
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.sg-ch-icon-btn:hover {
    border-color: rgba(135, 254, 254, 0.45);
    color: #fff;
}

.sg-ch-ed-body {
    position: relative;
    display: flex;
    flex: 1 1 auto;
    min-height: 180px;
    overflow: hidden;
    background: #0b1228;
}

.sg-ch-gutter {
    flex: 0 0 44px;
    margin: 0;
    padding: 14px 8px 14px 0;
    overflow: hidden;
    text-align: right;
    font: 13px/1.55 Consolas, "SF Mono", Monaco, monospace;
    color: rgba(189, 251, 255, 0.35);
    background: #0a1022;
    border-right: 1px solid rgba(135, 254, 254, 0.08);
    user-select: none;
    white-space: pre;
}

.sg-ch-code {
    flex: 1;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 14px 14px 14px 12px;
    border: 0;
    resize: none;
    outline: none;
    background: transparent;
    color: #e8fbff;
    font: 13px/1.55 Consolas, "SF Mono", Monaco, monospace;
    tab-size: 4;
    white-space: pre;
    overflow: auto;
}

.sg-ch-split {
    flex: 0 0 10px;
    cursor: row-resize;
    position: relative;
    background: rgba(5, 28, 68, 0.55);
    border-top: 1px solid rgba(135, 254, 254, 0.1);
    border-bottom: 1px solid rgba(135, 254, 254, 0.1);
}

.sg-ch-split::after {
    content: "······";
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -55%);
    letter-spacing: 2px;
    font-size: 10px;
    color: rgba(189, 251, 255, 0.45);
}

.sg-ch-console {
    display: flex;
    flex-direction: column;
    flex: 0 0 38%;
    min-height: 140px;
    background: rgba(5, 16, 42, 0.9);
}

.sg-ch-console-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    border-bottom: 1px solid rgba(135, 254, 254, 0.1);
}

.sg-ch-btn-sm {
    min-width: 0;
    height: 34px;
    padding: 0 14px;
    font-size: 13px;
    letter-spacing: 0.04em;
}

.sg-ch-btn-outline {
    background: transparent;
    border-color: rgba(59, 130, 246, 0.7);
    color: #93c5fd;
}

.sg-ch-btn-outline:hover {
    background: rgba(59, 130, 246, 0.15);
    color: #fff;
}

.sg-ch-io-grid {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}

.sg-ch-term {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    min-height: 0;
    border-right: 1px solid rgba(135, 254, 254, 0.1);
}

.sg-ch-term:last-child {
    border-right: 0;
}

.sg-ch-term-label {
    display: flex;
    align-items: center;
    justify-content: center;
    writing-mode: vertical-lr;
    text-orientation: upright;
    transform: none;
    font-size: 12px;
    font-weight: 450;
    letter-spacing: 0.28em;
    color: rgba(189, 251, 255, 0.55);
    background: rgba(3, 12, 32, 0.8);
    border-right: 1px solid rgba(135, 254, 254, 0.08);
}

.sg-ch-term-box {
    width: 100%;
    height: 100%;
    min-height: 110px;
    margin: 0;
    padding: 10px 12px;
    border: 0;
    resize: none;
    outline: none;
    background: #0b1228;
    color: #e8fbff;
    font: 13px/1.5 Consolas, "SF Mono", Monaco, monospace;
}

/* editor chrome extras */
.sg-ch-ed-title strong {
    font-size: 14px;
    font-weight: 450;
    color: #fff;
    letter-spacing: 0.02em;
}

.sg-ch-ed-top-right {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.sg-ch-lang-select {
    height: 32px;
    max-width: 190px;
    padding: 0 10px;
    border-radius: 10px;
    border: 1px solid rgba(135, 254, 254, 0.28);
    background: rgba(3, 16, 42, 0.9);
    color: #e8fbff;
    font-size: 12px;
    font-weight: 450;
    outline: none;
}

.sg-ch-ed-toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-bottom: 1px solid rgba(135, 254, 254, 0.1);
    background: rgba(5, 20, 48, 0.7);
    flex: 0 0 auto;
}

.sg-ch-ed-toolbar .sg-ch-icon-btn {
    width: 30px;
    height: 30px;
}

.sg-ch-icon-btn.is-on,
#stage_help.is-on {
    background: rgba(59, 130, 246, 0.35);
    border-color: rgba(125, 211, 252, 0.8);
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.35);
    color: #fff;
}

.sg-ch-workspace[data-theme="monokai"] .sg-ch-ed-body,
.sg-ch-workspace[data-theme="monokai"] .sg-ch-term-box {
    background: #272822;
}

.sg-ch-workspace[data-theme="monokai"] .sg-ch-gutter {
    background: #1e1f1c;
    color: #75715e;
}

.sg-ch-workspace[data-theme="monokai"] .sg-ch-code {
    color: #f8f8f2;
}

.sg-ch-workspace[data-theme="nord"] .sg-ch-ed-body,
.sg-ch-workspace[data-theme="nord"] .sg-ch-term-box {
    background: #2e3440;
}

.sg-ch-workspace[data-theme="nord"] .sg-ch-gutter {
    background: #3b4252;
    color: #7b88a1;
}

.sg-ch-workspace[data-theme="nord"] .sg-ch-code {
    color: #eceff4;
}

/* 白色底 IDE */
.sg-ch-workspace[data-theme="light"] {
    background: #f5f7fb;
    border-color: #e2e8f0;
    box-shadow: none;
    color: #0f172a;
}
.sg-ch-workspace[data-theme="light"] .sg-ch-ed-top {
    background: #fff;
    border-bottom-color: #e5e7eb;
}
.sg-ch-workspace[data-theme="light"] .sg-ch-ed-title strong {
    color: #111827;
}
.sg-ch-workspace[data-theme="light"] .sg-ch-lang-select {
    background: #fff;
    border-color: #d1d5db;
    color: #111827;
}
.sg-ch-workspace[data-theme="light"] .sg-ch-ed-toolbar {
    background: #f8fafc;
    border-bottom-color: #e5e7eb;
}
.sg-ch-workspace[data-theme="light"] .sg-ch-icon-btn {
    background: #fff;
    border-color: #d1d5db;
    color: #475569;
}
.sg-ch-workspace[data-theme="light"] .sg-ch-icon-btn:hover {
    border-color: #94a3b8;
    color: #0f172a;
    background: #f1f5f9;
}
.sg-ch-workspace[data-theme="light"] .sg-ch-icon-btn.is-on,
.sg-ch-workspace[data-theme="light"] #stage_help.is-on {
    background: #eff6ff;
    border-color: #93c5fd;
    box-shadow: none;
    color: #2563eb;
}
.sg-ch-workspace[data-theme="light"] .sg-ch-ed-body,
.sg-ch-workspace[data-theme="light"] .sg-ch-term-box {
    background: #ffffff;
}
.sg-ch-workspace[data-theme="light"] .sg-ch-gutter {
    background: #f8fafc;
    border-right-color: #e5e7eb;
    color: #94a3b8;
}
.sg-ch-workspace[data-theme="light"] .sg-ch-code {
    color: #0f172a;
}
.sg-ch-workspace[data-theme="light"] .sg-ch-split {
    background: #f1f5f9;
    border-color: #e5e7eb;
}
.sg-ch-workspace[data-theme="light"] .sg-ch-split::after {
    color: #94a3b8;
}
.sg-ch-workspace[data-theme="light"] .sg-ch-console {
    background: #fff;
}
.sg-ch-workspace[data-theme="light"] .sg-ch-console-bar {
    border-bottom-color: #e5e7eb;
    background: #f8fafc;
}
.sg-ch-workspace[data-theme="light"] .sg-ch-term {
    border-right-color: #e5e7eb;
}
.sg-ch-workspace[data-theme="light"] .sg-ch-term-label {
    color: #64748b;
    background: #f8fafc;
    border-right-color: #e5e7eb;
}
.sg-ch-workspace[data-theme="light"] .sg-ch-term-box {
    color: #0f172a;
}
.sg-ch-workspace[data-theme="light"] .sg-ch-btn-ghost {
    background: #fff;
    border: 1px solid #d1d5db;
    color: #334155;
}
.sg-ch-workspace[data-theme="light"] .sg-ch-btn-outline {
    border-color: #93c5fd;
    color: #2563eb;
}
.sg-ch-workspace[data-theme="light"] .sg-ch-btn-outline:hover {
    background: #eff6ff;
    color: #1d4ed8;
}
.sg-ch-workspace[data-theme="light"] .sg-ch-drawer {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-left: 1px solid #e2e8f0;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.12);
    color: #0f172a;
}
.sg-ch-workspace[data-theme="light"] .sg-ch-drawer-head {
    border-bottom-color: #e5e7eb;
    background: #f8fafc;
}
.sg-ch-workspace[data-theme="light"] .sg-ch-drawer-head strong {
    color: #0f172a;
}
.sg-ch-workspace[data-theme="light"] .sg-ch-kicker {
    color: #64748b !important;
}
.sg-ch-workspace[data-theme="light"] .sg-ch-chip {
    background: #f1f5f9;
    border-color: #e2e8f0;
    color: #334155;
}
.sg-ch-workspace[data-theme="light"] .sg-ch-chip:hover {
    background: #e2e8f0;
    color: #0f172a;
}
.sg-ch-workspace[data-theme="light"] .sg-ch-chip.is-active {
    background: #dcfce7;
    border-color: #86efac;
    color: #166534;
}
.sg-ch-workspace[data-theme="light"] .sg-ch-hist-row {
    color: #1e293b;
}
.sg-ch-workspace[data-theme="light"] .sg-ch-hist-head {
    color: #64748b;
    background: transparent;
}
.sg-ch-workspace[data-theme="light"] .sg-ch-hist-row:not(.sg-ch-hist-head):nth-child(odd) {
    background: #f8fafc;
}
.sg-ch-workspace[data-theme="light"] .sg-ch-hist-row:not(.sg-ch-hist-head):hover {
    background: #eff6ff;
}
.sg-ch-workspace[data-theme="light"] .sg-ch-hist-row .sg-ch-chip {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
}
.sg-ch-workspace[data-theme="light"] .sg-ch-hist-row .sg-ch-chip:hover {
    background: #1d4ed8;
    color: #fff;
}
.sg-ch-workspace[data-theme="light"] .sg-ch-badge.is-pend {
    background: #e2e8f0;
    color: #334155;
}
.sg-ch-workspace[data-theme="light"] .sg-ch-muted {
    color: #64748b !important;
}
.sg-ch-workspace[data-theme="light"] .sg-ch-help-card {
    background: #f8fafc;
    border-color: #e2e8f0;
    color: #1e293b;
}
.sg-ch-workspace[data-theme="light"] .sg-ch-ai-compose {
    border-top-color: #e5e7eb;
    background: #fff;
}
.sg-ch-workspace[data-theme="light"] .sg-ch-ai-compose textarea {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #0f172a;
}
.sg-ch-workspace[data-theme="light"] .sg-ch-modal-card {
    background: #fff;
    border-color: #e5e7eb;
    color: #0f172a;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.14);
}
.sg-ch-workspace[data-theme="light"] .sg-ch-modal-tabs button {
    background: #f8fafc;
    border-color: #e5e7eb;
    color: #475569;
}
.sg-ch-workspace[data-theme="light"] .sg-ch-modal-tabs button.is-active {
    color: #2563eb;
    border-color: #93c5fd;
    box-shadow: inset 0 -2px 0 #2563eb;
}
.sg-ch-workspace[data-theme="light"] .sg-ch-setting-row {
    background: #f8fafc;
    border-color: #e5e7eb;
}
.sg-ch-workspace[data-theme="light"] .sg-ch-setting-row strong {
    color: #111827;
}
.sg-ch-workspace[data-theme="light"] .sg-ch-setting-row small,
.sg-ch-workspace[data-theme="light"] .sg-ch-modal-hint {
    color: #64748b;
}
.sg-ch-workspace[data-theme="light"] .sg-ch-setting-row select,
.sg-ch-workspace[data-theme="light"] .sg-ch-tpl-code {
    background: #fff;
    border-color: #d1d5db;
    color: #0f172a;
}
.sg-ch-workspace[data-theme="light"] .sg-ch-hotkeys li {
    background: #f8fafc;
    border-color: #e5e7eb;
    color: #0f172a;
}
.sg-ch-workspace[data-theme="light"] .sg-ch-hotkeys code {
    color: #64748b;
}
.sg-ch-workspace[data-theme="light"] .sg-ch-modal-close {
    background: #f8fafc;
    border-color: #d1d5db;
    color: #334155;
}

/* 深色主题：抽屉/记录对比度微调 */
.sg-ch-workspace[data-theme="monokai"] .sg-ch-drawer,
.sg-ch-workspace[data-theme="nord"] .sg-ch-drawer,
.sg-ch-workspace[data-theme="dark"] .sg-ch-drawer {
    border-color: rgba(255, 255, 255, 0.12);
}
.sg-ch-workspace[data-theme="monokai"] .sg-ch-drawer {
    background: rgba(39, 40, 34, 0.98);
}
.sg-ch-workspace[data-theme="nord"] .sg-ch-drawer {
    background: rgba(46, 52, 64, 0.98);
}
.sg-ch-workspace[data-theme="monokai"] .sg-ch-hist-row,
.sg-ch-workspace[data-theme="nord"] .sg-ch-hist-row,
.sg-ch-workspace[data-theme="dark"] .sg-ch-hist-row {
    color: rgba(255, 255, 255, 0.92);
}
.sg-ch-workspace[data-theme="monokai"] .sg-ch-hist-head,
.sg-ch-workspace[data-theme="nord"] .sg-ch-hist-head,
.sg-ch-workspace[data-theme="dark"] .sg-ch-hist-head {
    color: rgba(255, 255, 255, 0.55);
}
.sg-ch-workspace[data-theme="monokai"] .sg-ch-chip:not(.is-active),
.sg-ch-workspace[data-theme="nord"] .sg-ch-chip:not(.is-active),
.sg-ch-workspace[data-theme="dark"] .sg-ch-chip:not(.is-active) {
    color: rgba(255, 255, 255, 0.88);
}
.sg-ch-workspace[data-theme="monokai"] .sg-ch-hist-row .sg-ch-chip,
.sg-ch-workspace[data-theme="nord"] .sg-ch-hist-row .sg-ch-chip,
.sg-ch-workspace[data-theme="dark"] .sg-ch-hist-row .sg-ch-chip {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #fff;
}
.sg-ch-workspace[data-theme="monokai"] .sg-ch-muted,
.sg-ch-workspace[data-theme="nord"] .sg-ch-muted,
.sg-ch-workspace[data-theme="dark"] .sg-ch-muted {
    color: rgba(255, 255, 255, 0.55) !important;
}

.sg-ch-modal {
    position: absolute;
    inset: 0;
    z-index: 40;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 48px 16px 16px;
    background: rgba(0, 0, 0, 0.45);
}

.sg-ch-modal[hidden] {
    display: none !important;
}

.sg-ch-confirm {
    position: absolute;
    inset: 0;
    z-index: 45;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(15, 23, 42, 0.45);
}
.sg-ch-confirm[hidden] {
    display: none !important;
}
.sg-ch-confirm-card {
    width: min(320px, 100%);
    padding: 28px 24px 20px;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.28);
    text-align: center;
}
.sg-ch-confirm-msg {
    margin: 0 0 22px;
    font-size: 16px;
    font-weight: 400;
    color: #1f2937;
}
.sg-ch-confirm-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
}
.sg-ch-confirm-cancel,
.sg-ch-confirm-ok {
    min-width: 88px;
    height: 36px;
    padding: 0 18px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 400;
    cursor: pointer;
}
.sg-ch-confirm-cancel {
    border: 1px solid #e5e7eb;
    background: #fff;
    color: #374151;
}
.sg-ch-confirm-cancel:hover {
    background: #f9fafb;
}
.sg-ch-confirm-ok {
    border: 0;
    background: #7c3aed;
    color: #fff;
}
.sg-ch-confirm-ok:hover {
    filter: brightness(1.06);
}

.sg-ch-icon-btn svg {
    display: block;
    margin: 0 auto;
}

.sg-ch-modal-card {
    width: min(440px, 100%);
    max-height: calc(100% - 24px);
    overflow: auto;
    border-radius: 14px;
    border: 1px solid rgba(135, 254, 254, 0.22);
    background: #121a2e;
    box-shadow: 0 24px 48px -20px rgba(0, 0, 0, 0.75);
    padding: 12px;
}

.sg-ch-modal-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-bottom: 12px;
}

.sg-ch-modal-tabs button {
    height: 34px;
    border-radius: 10px;
    border: 1px solid rgba(135, 254, 254, 0.14);
    background: rgba(5, 20, 48, 0.7);
    color: rgba(232, 251, 255, 0.75);
    font-size: 13px;
    font-weight: 450;
    cursor: pointer;
}

.sg-ch-modal-tabs button.is-active {
    color: #fff;
    border-color: rgba(245, 255, 127, 0.55);
    box-shadow: inset 0 -2px 0 rgba(245, 255, 127, 0.7);
}

.sg-ch-modal-pane {
    display: none;
}

.sg-ch-modal-pane.is-active {
    display: block;
}

.sg-ch-modal-hint {
    margin: 0 0 10px;
    font-size: 12px;
    color: rgba(189, 251, 255, 0.6);
    line-height: 1.5;
}

.sg-ch-setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(135, 254, 254, 0.12);
    background: rgba(5, 16, 42, 0.55);
}

.sg-ch-setting-row strong {
    display: block;
    font-size: 13px;
    color: #fff;
}

.sg-ch-setting-row small {
    display: block;
    margin-top: 2px;
    font-size: 11px;
    color: rgba(189, 251, 255, 0.55);
}

.sg-ch-setting-row select {
    height: 30px;
    min-width: 110px;
    border-radius: 8px;
    border: 1px solid rgba(135, 254, 254, 0.25);
    background: #0b1228;
    color: #e8fbff;
    padding: 0 8px;
}

.sg-ch-setting-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #3b82f6;
}

.sg-ch-tpl-code {
    width: 100%;
    min-height: 160px;
    margin: 8px 0;
    padding: 10px;
    border-radius: 10px;
    border: 1px solid rgba(135, 254, 254, 0.14);
    background: #0b1228;
    color: #e8fbff;
    font: 12px/1.5 Consolas, monospace;
    resize: vertical;
}

.sg-ch-tpl-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.sg-ch-hotkeys {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sg-ch-hotkeys li {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
    padding: 9px 12px;
    border-radius: 10px;
    background: rgba(5, 16, 42, 0.55);
    border: 1px solid rgba(135, 254, 254, 0.1);
    font-size: 13px;
    color: #e8fbff;
}

.sg-ch-hotkeys code {
    color: rgba(189, 251, 255, 0.75);
    font-size: 12px;
}

.sg-ch-modal-close {
    display: block;
    width: 100%;
    margin-top: 12px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid rgba(135, 254, 254, 0.22);
    background: rgba(5, 28, 68, 0.7);
    color: var(--sg-cyan-2);
    font-weight: 450;
    cursor: pointer;
}

.sg-ch-drawer {
    position: absolute;
    top: 84px;
    right: 10px;
    bottom: 12px;
    width: min(420px, calc(100% - 20px));
    z-index: 35;
    display: flex;
    flex-direction: column;
    border-radius: 14px;
    border: 1px solid rgba(135, 254, 254, 0.2);
    background: rgba(10, 18, 40, 0.96);
    box-shadow: 0 18px 40px -20px rgba(0, 0, 0, 0.8);
    overflow: hidden;
}

.sg-ch-drawer[hidden] {
    display: none !important;
}

.sg-ch-drawer-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 12px 10px;
    border-bottom: 1px solid rgba(135, 254, 254, 0.12);
}

.sg-ch-drawer-head strong {
    font-size: 16px;
    color: #fff;
}

.sg-ch-drawer-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
}

.sg-ch-chip {
    height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    border: 1px solid rgba(135, 254, 254, 0.18);
    background: rgba(5, 28, 68, 0.55);
    color: rgba(232, 251, 255, 0.8);
    font-size: 12px;
    font-weight: 450;
    cursor: pointer;
}

.sg-ch-chip.is-active {
    background: #d9f99d;
    border-color: #d9f99d;
    color: #14532d;
}

.sg-ch-hist-table {
    flex: 1;
    overflow: auto;
    padding: 8px;
}

.sg-ch-hist-row {
    display: grid;
    grid-template-columns: 56px minmax(0, 1.2fr) 110px 64px;
    gap: 8px;
    align-items: center;
    padding: 8px 10px;
    border-radius: 10px;
    margin-bottom: 4px;
    font-size: 12px;
    color: rgba(232, 251, 255, 0.88);
}

.sg-ch-hist-head {
    color: rgba(189, 251, 255, 0.55);
    font-weight: 450;
}

.sg-ch-hist-row:not(.sg-ch-hist-head):nth-child(odd) {
    background: rgba(255, 255, 255, 0.03);
}

.sg-ch-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 22px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 450;
}

.sg-ch-badge.is-ac {
    background: #22c55e;
    color: #fff;
}

.sg-ch-badge.is-wa {
    background: #ef4444;
    color: #fff;
}

.sg-ch-badge.is-pend {
    background: #64748b;
    color: #fff;
}

.sg-ch-help-body {
    padding: 12px;
    overflow: auto;
}

.sg-ch-help-card {
    margin-bottom: 10px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid rgba(135, 254, 254, 0.14);
    background: rgba(5, 20, 48, 0.65);
    color: rgba(232, 251, 255, 0.9);
    line-height: 1.65;
    font-size: 13px;
}

.sg-ch-workspace {
    position: relative;
}


.sg-ch-ai-compose {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    padding: 10px 12px 12px;
    border-top: 1px solid rgba(135, 254, 254, 0.12);
    background: rgba(5, 16, 42, 0.75);
}
.sg-ch-ai-compose textarea {
    width: 100%;
    min-height: 56px;
    resize: vertical;
    border-radius: 10px;
    border: 1px solid rgba(135, 254, 254, 0.2);
    background: #0b1228;
    color: #e8fbff;
    padding: 8px 10px;
    font-size: 13px;
    line-height: 1.5;
    outline: none;
}
.sg-ch-ai-user {
    border-color: rgba(59, 130, 246, 0.35);
    background: rgba(37, 99, 235, 0.12);
}
.sg-ch-ai-bot, .sg-ch-ai-sys {
    border-color: rgba(135, 254, 254, 0.16);
}
.sg-ch-ai-text {
    white-space: pre-wrap;
    word-break: break-word;
}
.sg-ch-help-body {
    flex: 1;
    min-height: 0;
}
.sg-ch-drawer.sg-ch-help {
    position: fixed;
    top: 96px;
    right: 24px;
    left: auto;
    bottom: auto;
    width: min(420px, calc(100vw - 32px));
    height: min(560px, calc(100vh - 48px));
    z-index: 120;
    display: flex;
    flex-direction: column;
}
.sg-ch-drawer.sg-ch-help[hidden] {
    display: none !important;
}
.sg-ch-drawer.sg-ch-help .sg-ch-drawer-head {
    cursor: grab;
    user-select: none;
    touch-action: none;
}
.sg-ch-drawer.sg-ch-help.is-dragging .sg-ch-drawer-head {
    cursor: grabbing;
}
.sg-ch-drawer.sg-ch-help .sg-ch-drawer-head .sg-ch-icon-btn {
    cursor: pointer;
}

/* exit confirm */
.sg-ch-exit {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(2, 6, 28, 0.72);
    backdrop-filter: blur(4px);
}
.sg-ch-exit[hidden] { display: none !important; }
.sg-ch-exit-card {
    width: min(440px, 100%);
    padding: 22px 24px 20px;
    border-radius: 16px;
    border: 1px solid rgba(135, 254, 254, 0.35);
    background:
        linear-gradient(180deg, rgba(12, 40, 88, 0.95), rgba(5, 18, 48, 0.98)),
        repeating-linear-gradient(0deg, transparent, transparent 11px, rgba(135,254,254,0.035) 12px),
        repeating-linear-gradient(90deg, transparent, transparent 11px, rgba(135,254,254,0.035) 12px);
    box-shadow:
        0 0 0 1px rgba(56, 189, 248, 0.12),
        0 24px 48px -18px rgba(0, 0, 0, 0.75),
        inset 0 1px 0 rgba(255,255,255,0.06);
    position: relative;
}
.sg-ch-exit-card::before,
.sg-ch-exit-card::after {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(135, 254, 254, 0.65);
    pointer-events: none;
}
.sg-ch-exit-card::before {
    top: 8px; left: 8px;
    border-right: 0; border-bottom: 0;
}
.sg-ch-exit-card::after {
    right: 8px; bottom: 8px;
    border-left: 0; border-top: 0;
}
.sg-ch-exit-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 12px;
    margin-bottom: 16px;
    border-bottom: 1px solid rgba(232, 251, 255, 0.28);
}
.sg-ch-exit-head h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 450;
    color: #fff;
}
.sg-ch-exit-x {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: rgba(232, 251, 255, 0.75);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}
.sg-ch-exit-x:hover { color: #fff; background: rgba(135,254,254,0.08); }
.sg-ch-exit-msg {
    margin: 0 0 22px;
    font-size: 15px;
    line-height: 1.75;
    color: rgba(232, 251, 255, 0.92);
}
.sg-ch-exit-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}
.sg-ch-exit-actions .sg-ch-btn {
    min-width: 96px;
}


.sg-ch-tpl-toast {
    margin: 10px 0 0;
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(34, 197, 94, 0.18);
    border: 1px solid rgba(34, 197, 94, 0.45);
    color: #bbf7d0;
    font-size: 13px;
    font-weight: 450;
}
.sg-ch-tpl-toast[hidden] { display: none !important; }

.sg-ch-side {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
    overflow: auto;
}

.sg-ch-side-card {
    padding: 16px;
    border-radius: 16px;
    background: rgba(5, 28, 68, 0.55);
    border: 1px solid rgba(135, 254, 254, 0.14);
}

.sg-ch-side-text {
    margin: 0;
    font-size: 13px;
    line-height: 1.7;
    color: rgba(232, 251, 255, 0.86);
}

.sg-ch-side-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.sg-ch-side-meta > div {
    padding: 14px;
    border-radius: 14px;
    background: rgba(5, 28, 68, 0.55);
    border: 1px solid rgba(135, 254, 254, 0.14);
}

.sg-ch-side-meta em {
    display: block;
    margin-bottom: 6px;
    font-style: normal;
    font-size: 12px;
    color: rgba(189, 251, 255, 0.65);
}

.sg-ch-side-meta strong {
    font-size: 22px;
    font-weight: 450;
    color: #fff;
}

.sg-ch-side-meta small {
    margin-left: 4px;
    font-size: 12px;
    font-weight: 400;
    color: rgba(189, 251, 255, 0.65);
}

.sg-ch-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    max-width: 1440px;
    width: 100%;
    margin: 0 auto;
    padding: 8px 20px 18px;
}

.sg-ch-progress {
    margin: 0;
    font-size: 13px;
    font-weight: 450;
    color: rgba(189, 251, 255, 0.7);
    font-variant-numeric: tabular-nums;
}

.sg-ch-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 120px;
    height: 44px;
    padding: 0 18px;
    border-radius: 12px;
    border: 1px solid transparent;
    font-size: 14px;
    font-weight: 450;
    letter-spacing: 0.06em;
    text-decoration: none !important;
    cursor: pointer;
    transition: transform 0.2s var(--sg-ease), filter 0.2s ease, opacity 0.2s ease;
}

.sg-ch-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
}

.sg-ch-btn-primary {
    background: linear-gradient(180deg, #3b82f6 0%, #1d4ed8 100%);
    color: #fff !important;
    box-shadow: 0 12px 28px -16px rgba(37, 99, 235, 0.85);
}

.sg-ch-btn-primary:hover {
    transform: translateY(-1px);
    filter: brightness(1.05);
}

.sg-ch-btn-ghost {
    background: rgba(5, 28, 68, 0.55);
    border-color: rgba(135, 254, 254, 0.28);
    color: var(--sg-cyan-2);
}

.sg-ch-btn-ghost:hover:not(:disabled) {
    border-color: rgba(135, 254, 254, 0.5);
    color: #fff;
    transform: translateY(-1px);
}

.sg-ch-empty {
    grid-column: 1 / -1;
    max-width: 640px;
    margin: auto;
    padding: 36px 28px;
    border-radius: 20px;
    background: rgba(5, 28, 68, 0.6);
    border: 1px solid rgba(135, 254, 254, 0.16);
}

.sg-ch-empty h1 {
    margin: 0 0 14px;
    color: #fff;
}

.sg-ch-empty p {
    margin: 0 0 10px;
    line-height: 1.7;
    color: rgba(232, 251, 255, 0.88);
}

.sg-ch-muted {
    color: rgba(189, 251, 255, 0.58) !important;
    font-size: 13px;
}

@media (max-width: 1100px) {
    .sg-ch-main {
        grid-template-columns: 56px minmax(0, 1fr);
        grid-template-rows: minmax(240px, 1fr) minmax(280px, 0.9fr);
    }

    .sg-ch-workspace {
        grid-column: 1 / -1;
    }

    .sg-ch-side {
        display: none;
    }
}

@media (max-width: 760px) {
    body.sg-ch-body {
        overflow: auto;
    }

    .sg-ch {
        height: auto;
        max-height: none;
        overflow: visible;
        min-height: 100vh;
    }

    .sg-ch-top {
        grid-template-columns: 1fr;
        justify-items: stretch;
    }

    .sg-ch-back,
    .sg-ch-timer,
    .sg-ch-stage {
        justify-self: stretch;
        text-align: left;
    }

    .sg-ch-main {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        padding: 8px 14px;
    }

    .sg-ch-nav {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: flex-start;
        overflow: auto;
    }

    .sg-ch-board {
        min-height: 42vh;
    }

    .sg-ch-workspace {
        min-height: 52vh;
        grid-column: auto;
    }

    .sg-ch-io-grid {
        grid-template-columns: 1fr;
    }

    .sg-ch-term {
        border-right: 0;
        border-bottom: 1px solid rgba(135, 254, 254, 0.1);
    }

    .sg-ch-sample {
        grid-template-columns: 1fr;
    }

    .sg-ch-bottom {
        padding: 8px 14px 20px;
    }

    .sg-ch-btn {
        min-width: 0;
        flex: 1;
    }
}

/* ---- challenge / guide 补充（旧类名保留） ---- */
html,
body.stage-body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #03072f;
    font-family: inherit;
}

.stage-avatar {
    overflow: hidden;
    border-radius: 50%;
}

.stage-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.stage-exit {
    margin-left: 1.5vw;
    color: #bdfbff;
    text-decoration: none;
    font-size: 0.937vw;
    opacity: 0.85;
}

.stage-exit:hover {
    opacity: 1;
    color: #87fefe;
}

.Button_btn__eCC4l.disabled,
.Button_btn__eCC4l:disabled {
    background-image: url(/uploads/stage/btn2_disabled.png);
    cursor: not-allowed;
    pointer-events: none;
}

.stage-challenge-body {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.stage-q-item {
    display: none;
}

.stage-q-item.is-active {
    display: block;
}

.stage-q-actions {
    margin-top: 24px;
}

.stage-challenge-empty {
    padding: 24px 8px;
    color: #bdfbff;
    line-height: 1.7;
}

.stage-challenge-empty h2 {
    color: #87fefe;
    margin-top: 0;
}

.stage-muted {
    color: rgba(189, 251, 255, 0.7);
    font-size: 14px;
}

.stage-link-btn {
    display: inline-block;
    margin-top: 16px;
    padding: 10px 20px;
    color: #87fefe;
    border: 1px solid rgba(189, 251, 255, 0.5);
    text-decoration: none;
    border-radius: 4px;
}

.stage-link-btn:hover {
    color: #fff;
    border-color: #87fefe;
}

/* —— 主题按钮/控制台（放在文件末尾，避免被基础 .sg-ch-btn 覆盖） —— */
.sg-ch-workspace[data-theme="light"] .sg-ch-console-bar {
    background: #f1f5f9;
    border-bottom: 1px solid #e2e8f0;
}
.sg-ch-workspace[data-theme="light"] .sg-ch-split {
    background: #e2e8f0;
    border-color: #cbd5e1;
}
.sg-ch-workspace[data-theme="light"] .sg-ch-btn.sg-ch-btn-ghost {
    background: #ffffff !important;
    border: 1px solid #94a3b8 !important;
    color: #0f172a !important;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}
.sg-ch-workspace[data-theme="light"] .sg-ch-btn.sg-ch-btn-ghost:hover:not(:disabled) {
    background: #f8fafc !important;
    border-color: #64748b !important;
    color: #020617 !important;
}
.sg-ch-workspace[data-theme="light"] .sg-ch-btn.sg-ch-btn-outline {
    background: #ffffff !important;
    border: 1px solid #3b82f6 !important;
    color: #1d4ed8 !important;
}
.sg-ch-workspace[data-theme="light"] .sg-ch-btn.sg-ch-btn-outline:hover:not(:disabled) {
    background: #eff6ff !important;
    color: #1e40af !important;
}
.sg-ch-workspace[data-theme="light"] .sg-ch-btn.sg-ch-btn-primary {
    color: #fff !important;
}
.sg-ch-workspace[data-theme="light"] .sg-ch-console-bar .sg-ch-icon-btn {
    background: #ffffff;
    border-color: #94a3b8;
    color: #334155;
}

.sg-ch-workspace[data-theme="monokai"] .sg-ch-btn.sg-ch-btn-ghost,
.sg-ch-workspace[data-theme="nord"] .sg-ch-btn.sg-ch-btn-ghost,
.sg-ch-workspace[data-theme="dark"] .sg-ch-btn.sg-ch-btn-ghost {
    color: #e2e8f0 !important;
    border-color: rgba(255, 255, 255, 0.28) !important;
}
.sg-ch-workspace[data-theme="monokai"] .sg-ch-btn.sg-ch-btn-outline,
.sg-ch-workspace[data-theme="nord"] .sg-ch-btn.sg-ch-btn-outline,
.sg-ch-workspace[data-theme="dark"] .sg-ch-btn.sg-ch-btn-outline {
    color: #93c5fd !important;
    border-color: #60a5fa !important;
}
