/* ============================================
   容器
   ============================================ */
body::before,
body::after {
    pointer-events: none;
}

/* ============================================
   容器
   ============================================ */
.container {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    position: relative;
    z-index: 1;
    min-height: 100vh;
}

:root {
    --side-rail-width: 248px;
}

/* ============================================
   布局：双栏（侧栏 + 主区）
   ============================================ */
.app-shell {
    display: grid;
    grid-template-columns: 248px minmax(0, 1fr);
    gap: 0;
    align-items: stretch;
    min-height: 100vh;
    height: 100vh;
    overflow: hidden;
    background: transparent;
}

.app-shell.standalone {
    grid-template-columns: 1fr;
}

.side-rail {
    position: sticky;
    top: 0;
    align-self: stretch;
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 14px 10px;
    background:
        linear-gradient(180deg, rgba(255, 252, 248, 0.95) 0%, rgba(255, 248, 241, 0.89) 100%);
    border-right: 1px solid rgba(137, 111, 94, 0.10);
    border-radius: 0;
    box-shadow: 8px 0 28px rgba(92, 68, 52, 0.05), 1px 0 0 rgba(255, 255, 255, 0.5);
    min-height: 100vh;
    scrollbar-width: none;
    -ms-overflow-style: none;
    backdrop-filter: blur(18px) saturate(130%);
}

.side-rail::-webkit-scrollbar {
    display: none;
}

.side-section {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 8px 4px;
}

.side-section + .side-section {
    border-top: 1px solid rgba(137, 111, 94, 0.08);
}

.side-rail-nav {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    gap: 0;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.side-rail-nav::-webkit-scrollbar {
    display: none;
}

.lang-fab {
    display: none;
}

.lang-fab .lang-switch {
    width: auto;
}

.lang-choice {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px;
    border-radius: 999px;
    border: 1px solid rgba(163, 146, 134, 0.32);
    background: rgba(255, 253, 252, 0.92);
    box-shadow: 0 14px 34px rgba(27, 23, 20, 0.22);
    backdrop-filter: blur(10px);
}

.lang-choice-btn {
    min-width: 44px;
    height: 30px;
    border-radius: 999px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--color-text-secondary);
    font-family: var(--font-family-mono);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    transition: background-color var(--transition-fast) var(--ease-smooth), border-color var(--transition-fast) var(--ease-smooth), color var(--transition-fast) var(--ease-smooth), transform var(--transition-fast) var(--ease-smooth);
}

.lang-choice-btn:hover {
    border-color: rgba(163, 146, 134, 0.32);
    background: rgba(255, 255, 255, 0.72);
    color: var(--color-text-primary);
}

.lang-choice-btn.active {
    border-color: rgba(200, 121, 99, 0.55);
    background: rgba(200, 121, 99, 0.14);
    color: var(--color-brand-dark);
}

.lang-choice-btn:active {
    transform: translateY(1px);
}

.lang-fab .lang-switch-track {
    box-shadow: 0 14px 34px rgba(27, 23, 20, 0.22);
    background: rgba(255, 253, 252, 0.92);
}

.lang-fab .lang-switch:hover .lang-switch-track {
    transform: translateY(-1px);
}

.lang-fab .lang-switch:active .lang-switch-track {
    transform: translateY(0);
}

.lang-fab .lang-switch-track::after {
    opacity: 1;
}

.lang-fab .lang-switch-text {
    color: var(--color-text-primary);
}

.lang-fab {
    position: fixed;
    left: 0;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    width: var(--side-rail-width, 248px);
    transform: none;
    z-index: 60;
    pointer-events: none;
    justify-content: center;
}

.lang-fab .lang-choice {
    pointer-events: auto;
    position: relative;
    z-index: 1;
}

.lang-fab .lang-switch {
    pointer-events: auto;
}

.lang-fab::before {
    content: "";
    position: absolute;
    inset: -12px -18px;
    background: radial-gradient(circle at 50% 70%, rgba(250, 250, 250, 0.92), rgba(250, 250, 250, 0));
    filter: blur(2px);
    pointer-events: none;
}

.lang-fab > .lang-switch {
    position: relative;
    z-index: 1;
}

.lang-fab .lang-switch-track {
    border-color: rgba(163, 146, 134, 0.32);
    backdrop-filter: blur(10px);
}

.lang-fab .lang-switch:hover .lang-switch-track {
    border-color: rgba(200, 121, 99, 0.7);
}

.side-rail-lang {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 2;
    padding: 10px 4px 6px;
    background: linear-gradient(180deg, rgba(255, 248, 241, 0), rgba(255, 248, 241, 0.94) 28%);
    border-top: 1px solid rgba(137, 111, 94, 0.08);
    backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.side-rail-lang .lang-choice {
    background: rgba(255, 253, 252, 0.9);
    box-shadow: none;
    backdrop-filter: none;
}

.lang-switch {
    width: 100%;
    border: none;
    background: transparent;
    padding: 0;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
}

.lang-switch-track {
    width: 52px;
    height: 34px;
    border-radius: 999px;
    border: 1px solid rgba(163, 146, 134, 0.38);
    background: rgba(255, 253, 252, 0.78);
    box-shadow: 0 1px 2px rgba(36, 31, 28, 0.06);
    display: grid;
    place-items: center;
    position: relative;
    overflow: hidden;
    transition: border-color var(--transition-fast) var(--ease-smooth), background-color var(--transition-fast) var(--ease-smooth), transform var(--transition-fast) var(--ease-smooth);
}

.lang-switch:hover .lang-switch-track {
    border-color: rgba(200, 121, 99, 0.6);
    background: rgba(255, 253, 252, 0.92);
    transform: translateY(-1px);
}

.lang-switch:active .lang-switch-track {
    transform: translateY(0);
}

.lang-switch-text {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-family: var(--font-family-mono);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-text-secondary);
    transition: transform 220ms var(--ease-spring), opacity 220ms var(--ease-spring);
    will-change: transform, opacity;
    opacity: 0;
    transform: translateY(10px);
}

.lang-switch-track[data-lang="zh"] .lang-switch-zh {
    opacity: 1;
    transform: translateY(0);
}

.lang-switch-track[data-lang="zh"] .lang-switch-en {
    opacity: 0;
}

.lang-switch-track[data-lang="en"] .lang-switch-en {
    opacity: 1;
    transform: translateY(0);
}

.lang-switch-track[data-lang="en"] .lang-switch-zh {
    opacity: 0;
}

.lang-switch-track::after {
    content: "";
    position: absolute;
    inset: -20px;
    background: radial-gradient(circle at 30% 20%, rgba(200, 121, 99, 0.18), rgba(200, 121, 99, 0) 55%);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 240ms var(--ease-smooth), transform 240ms var(--ease-smooth);
    pointer-events: none;
}

.lang-switch:hover .lang-switch-track::after {
    opacity: 1;
    transform: translateY(0);
}

.side-section-title {
    font-size: 10px;
    font-weight: 700;
    color: var(--color-text-muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0 8px;
    margin-bottom: 6px;
    opacity: 0.72;
}

.side-item {
    width: 100%;
    text-align: left;
    padding: 9px 12px 9px 14px;
    border-radius: 12px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: border-color 180ms var(--ease-out-expo), background-color 180ms var(--ease-out-expo), color 180ms var(--ease-out-expo), box-shadow 180ms var(--ease-out-expo), transform 180ms var(--ease-out-expo);
    display: flex;
    flex-direction: column;
    gap: 3px;
    box-shadow: none;
    position: relative;
}

.side-item::before {
    content: "";
    position: absolute;
    left: 2px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 18px;
    border-radius: 0 3px 3px 0;
    background: transparent;
}

.side-item:hover {
    background: rgba(255, 255, 255, 0.64);
    color: var(--color-text-primary);
    transform: translateX(2px);
}

.side-item.active,
.side-item.nav-intent-active {
    border-color: rgba(200, 121, 99, 0.22);
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.86), rgba(200, 121, 99, 0.10));
    color: var(--color-brand-dark);
    box-shadow: 0 8px 20px rgba(92, 68, 52, 0.06);
}

.side-item.nav-intent-inactive,
.side-item.active.nav-intent-inactive {
    border-color: transparent;
    background: transparent;
    color: var(--color-text-secondary);
    box-shadow: none;
}

.side-item.active::before,
.side-item.nav-intent-active::before {
    background: var(--color-brand);
}

.side-item.nav-intent-inactive::before,
.side-item.active.nav-intent-inactive::before {
    background: transparent;
}

.side-item-title {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.25;
}

.side-item-meta {
    font-size: 11px;
    color: var(--color-text-muted);
    display: flex;
    opacity: 1;
    gap: 5px;
    flex-wrap: wrap;
    line-height: 1.4;
    min-height: 1.4em;
}

.side-item.active .side-item-meta,
.side-item.nav-intent-active .side-item-meta {
    color: var(--color-text-secondary);
}

.side-item-meta > span {
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

@media (min-width: 721px) {
    body:not(.force-compact) #app > .top-tabs {
        display: none;
    }
}

.brand-block {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 0;
    padding: 14px 10px 16px;
    border-bottom: 1px solid rgba(137, 111, 94, 0.10);
}

.brand-head {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-logo {
    width: 38px;
    height: 38px;
    border-radius: 13px;
    object-fit: cover;
    flex-shrink: 0;
    box-shadow:
        0 8px 20px rgba(92, 68, 52, 0.10),
        0 0 0 1px rgba(200, 121, 99, 0.08);
}

.brand-copy {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.brand-kicker {
    font-size: 18px;
    line-height: 1.15;
    font-family: var(--font-family-display);
    color: var(--color-text-primary);
    letter-spacing: -0.02em;
    font-weight: 700;
}

.brand-version {
    font-size: 11px;
    font-weight: 500;
    color: var(--color-text-muted);
    vertical-align: middle;
    margin-left: 4px;
}

.brand-subtitle {
    font-size: 12px;
    line-height: 1.45;
    color: var(--color-text-secondary);
    max-width: 22ch;
}

.github-badge {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 0;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text-secondary);
    font-size: var(--font-size-caption);
    text-decoration: none;
    box-shadow: none;
    transition: border-color var(--transition-fast) var(--ease-smooth), background-color var(--transition-fast) var(--ease-smooth), color var(--transition-fast) var(--ease-smooth), box-shadow var(--transition-fast) var(--ease-smooth);
    min-width: 0;
    backdrop-filter: none;
}

.github-badge-rail {
    width: calc(100% - 24px);
    margin: 0 12px 12px;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.62);
    border: 1px solid rgba(137, 111, 94, 0.15);
    box-shadow: var(--shadow-subtle);
}

.github-badge:hover {
    border-color: var(--color-border-strong);
    background: var(--color-surface-alt);
    color: var(--color-text-primary);
    box-shadow: none;
}

.github-badge:focus-visible {
    outline: 3px solid rgba(200, 121, 99, 0.18);
    outline-offset: 2px;
    border-color: var(--color-brand);
    color: var(--color-text-primary);
    background: var(--color-surface);
}

.github-badge-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.github-badge-left {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.github-badge-label {
    font-size: var(--font-size-caption);
    font-weight: var(--font-weight-secondary);
    color: var(--color-text-secondary);
}

.github-badge-text {
    min-width: 0;
    font-family: var(--font-family-mono);
    font-size: var(--font-size-caption);
    color: var(--color-text-tertiary);
    line-height: 1.3;
    display: inline-block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.github-badge-text > span {
    white-space: nowrap;
}

.github-owner {
    font-weight: 600;
    color: var(--color-text-secondary);
}

.github-sep {
    margin: 0 2px;
    color: var(--color-text-tertiary);
}

.github-repo {
    font-weight: 600;
    color: var(--color-text-primary);
}

.github-badge-rail .github-badge-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    color: var(--color-text-secondary);
}

.github-badge-rail .github-sep {
    display: none;
}

.github-badge-rail .github-owner,
.github-badge-rail .github-repo {
    font-weight: 600;
}

.github-badge-rail .github-badge-left {
    padding: 4px;
    border-radius: 999px;
    background: var(--color-brand-light);
}

.github-badge-rail .github-badge-label {
    display: none;
}

.github-badge-rail:hover {
    border-color: var(--color-border-strong);
}

/* 侧边栏计数徽标 */
.side-item-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: var(--color-brand);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    box-shadow: 0 2px 6px rgba(200, 121, 99, 0.28);
}
