/* 勇士的信仰 — 详情页布局（对齐 xy-editor / save-editor-modern 蓝紫主题） */

.save-editor-body .detail-page.ys-detail-page {
    width: 100%;
    max-width: 1200px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 3rem);
    min-height: calc(100vh - 3rem);
    max-height: calc(100vh - 3rem);
}

.ys-detail-page .detail-header {
    flex-shrink: 0;
}

.ys-detail-layout {
    display: flex;
    flex: 1;
    min-height: 0;
    align-items: stretch;
    overflow: hidden;
}

.ys-sidebar {
    width: 200px;
    flex-shrink: 0;
    border-right: 1px solid var(--border);
    background: var(--bg-input);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.65rem 0.35rem;
    align-self: stretch;
}

.ys-nav-btn {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.5rem 0.85rem;
    margin-bottom: 2px;
    border: none;
    border-radius: var(--radius-sm, 8px);
    background: transparent;
    color: var(--text-muted);
    font-size: 0.8125rem;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.ys-nav-btn:hover {
    background: rgba(99, 102, 241, 0.08);
    color: var(--text);
}

.ys-nav-btn.active {
    background: var(--primary-bg, rgba(99, 102, 241, 0.12));
    color: var(--primary);
    font-weight: 600;
}

.ys-content {
    flex: 1;
    min-width: 0;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.85rem 1rem 1.25rem;
    background: var(--bg-card, var(--bg-page));
}

.ys-content .panel {
    display: none;
}

.ys-content .panel.active {
    display: block;
    min-height: 100%;
    box-sizing: border-box;
}

.ys-panel {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm, 10px);
    padding: 0.85rem 1rem;
    margin-bottom: 10px;
}

.ys-panel h3 {
    margin: 0 0 0.65rem;
    font-size: 0.9rem;
    color: var(--text);
    font-weight: 600;
}

.ys-sub {
    font-weight: 400;
    color: var(--text-dim);
    font-size: 0.75rem;
}

.ys-kv-grid,
.ys-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.65rem 0.85rem;
    align-items: start;
}

.ys-kv-grid div span,
.ys-field span {
    display: block;
    font-size: 0.72rem;
    color: var(--text-dim);
    margin-bottom: 0.2rem;
}

.ys-field {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.ys-field .input {
    width: 100%;
    min-height: 36px;
    box-sizing: border-box;
}

.ys-quick-row,
.ys-quick-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 0.5rem;
}

.ys-tip,
.ys-inline-tip {
    margin: 0.65rem 0 0;
    font-size: 0.72rem;
    color: var(--text-dim);
    line-height: 1.45;
}

.ys-inline-tip {
    margin: 0 0 0.5rem;
    font-size: 0.75rem;
}

.ys-tip a {
    color: var(--primary);
}

.ys-kaima-hint {
    margin-top: 0.75rem;
    padding: 0.65rem 0.85rem;
    border-radius: var(--radius-sm);
    background: var(--primary-bg, rgba(99, 102, 241, 0.08));
    border: 1px solid rgba(99, 102, 241, 0.2);
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.ys-tag-list {
    margin: 0;
    padding-left: 1.1rem;
    font-size: 0.8125rem;
    line-height: 1.75;
    color: var(--text-muted);
}

.ys-empty {
    color: var(--text-dim);
    font-size: 0.8125rem;
    margin: 0;
}

.ys-stat {
    margin: 0;
    font-size: 0.8125rem;
    color: var(--text-muted);
    word-break: break-all;
}

.ys-item-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
    margin-top: 0.5rem;
}

.ys-item-table th,
.ys-item-table td {
    border: 1px solid var(--border);
    padding: 0.35rem 0.5rem;
    text-align: left;
}

.ys-item-table th {
    background: var(--bg-card);
    color: var(--text-muted);
    font-weight: 500;
}

.ys-collapse {
    margin-top: 0.65rem;
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 0.35rem 0.65rem;
}

.ys-collapse summary {
    cursor: pointer;
    font-size: 0.8125rem;
    color: var(--text);
    padding: 0.25rem 0;
}

.ys-gk-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
    gap: 4px;
    max-height: 50vh;
    overflow-y: auto;
    margin-top: 0.75rem;
    padding: 0.25rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.ys-gk-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-size: 0.65rem;
    color: var(--text-dim);
    padding: 2px;
    border-radius: 4px;
    cursor: pointer;
}

.ys-gk-cell:hover {
    background: rgba(99, 102, 241, 0.06);
}

.ys-gk-cell input {
    margin: 0;
    cursor: pointer;
}

.ys-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.65rem;
}

.ys-table-wrap {
    overflow-x: auto;
    margin-top: 0.5rem;
}

.ys-item-table--actions td,
.ys-item-table--actions th {
    vertical-align: middle;
}

.ys-skill-table code {
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    font-size: 0.78rem;
    color: var(--accent);
}

.ys-skill-filter {
    margin: 0.5rem 0;
    max-width: 220px;
}

.ys-field em.ys-sub {
    font-style: normal;
    font-weight: 400;
}

.ys-add-item-results {
    max-height: 220px;
    overflow-y: auto;
    margin-top: 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
}

.ys-add-item-list {
    display: flex;
    flex-direction: column;
}

.ys-add-item-pick {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    text-align: left;
    padding: 0.45rem 0.65rem;
    border: none;
    border-bottom: 1px solid var(--border);
    background: transparent;
    color: var(--text);
    font-size: 0.78rem;
    font-family: inherit;
    cursor: pointer;
}

.ys-add-item-pick:hover {
    background: rgba(99, 102, 241, 0.06);
}

.ys-add-item-pick--active {
    background: var(--primary-bg, rgba(99, 102, 241, 0.12));
}

.ys-add-item-pick-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ys-add-item-pick-id {
    flex-shrink: 0;
    color: var(--text-dim);
    font-family: var(--font-mono, monospace);
    font-size: 0.72rem;
}

.ys-mobile-nav-toggle {
    display: none;
    margin: 0 1rem 0.5rem;
    flex-shrink: 0;
}

@media (max-width: 900px) {
    .save-editor-body .detail-page.ys-detail-page {
        height: auto;
        max-height: none;
        min-height: calc(100dvh - 1.5rem);
    }

    .ys-detail-layout {
        min-height: 0;
        overflow: visible;
    }

    .ys-sidebar.open {
        max-height: min(45vh, 320px);
        overflow-y: auto;
    }

    .ys-content {
        min-height: 40vh;
        max-height: none;
        overflow-y: auto;
    }
}

@media (max-width: 768px) {
    .save-editor-body .detail-page.ys-detail-page {
        height: auto;
        min-height: calc(100dvh - 1rem);
        max-height: none;
        border-radius: 14px;
    }

    .ys-detail-layout {
        flex-direction: column;
        overflow: visible;
        min-height: 0;
    }

    .ys-sidebar {
        display: none;
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 0.5rem;
    }

    .ys-sidebar.open {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.35rem;
    }

    .ys-sidebar.open .ys-nav-btn {
        width: auto;
        flex: 1 1 calc(50% - 0.35rem);
        text-align: center;
    }

    .ys-mobile-nav-toggle {
        display: inline-flex;
    }

    .ys-gk-grid {
        grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
    }
}
