/* 游戏报错列表弹窗 */

.ai-errors-toggle {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    border-radius: 6px;
    color: #9d9d9d;
    font-size: 11px;
    white-space: nowrap;
}

.ai-errors-toggle:hover {
    background: #333;
    color: #ccc;
}

.ai-errors-check {
    display: inline-flex;
    align-items: center;
    padding: 4px 2px 4px 6px;
    margin: 0;
    cursor: pointer;
}

.ai-errors-check input {
    margin: 0;
    accent-color: #2d5a3d;
    cursor: pointer;
}

.ai-errors-open {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 6px 4px 2px;
    border: none;
    background: transparent;
    color: inherit;
    font: inherit;
    cursor: pointer;
    border-radius: 4px;
}

.ai-errors-open:hover {
    color: #e0e0e0;
}

.ai-errors-badge {
    cursor: pointer;
}

.ai-errors-overlay {
    position: fixed;
    inset: 0;
    z-index: 100001;
    display: flex;
    /* 顶部对齐：避免弹窗高度变化时垂直居中导致列表项位移、hover 反复触发 */
    align-items: flex-start;
    justify-content: center;
    background: rgba(0, 0, 0, 0.55);
    padding: max(12px, 6vh) 12px 12px;
    overflow-y: auto;
}

.ai-errors-overlay[hidden] {
    display: none !important;
}

.ai-errors-modal {
    width: 100%;
    max-width: 720px;
    /* 固定高度：悬停预览切换不同堆栈长度时不抖动 */
    height: min(560px, 88vh);
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    background: #1a1f26;
    border: 1px solid #30363d;
    border-radius: 10px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
    color: #c9d1d9;
    font-size: 13px;
    flex-shrink: 0;
}

.ai-errors-modal__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px 8px;
    border-bottom: 1px solid #30363d;
}

.ai-errors-modal__title {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #e6edf3;
}

.ai-errors-modal__close {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #8b949e;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.ai-errors-modal__close:hover {
    background: #30363d;
    color: #e6edf3;
}

.ai-errors-modal__hint {
    margin: 0;
    padding: 8px 14px;
    font-size: 11px;
    color: #8b949e;
    border-bottom: 1px solid #252b33;
}

.ai-errors-modal__body {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(200px, 38%) 1fr;
    gap: 0;
    overflow: hidden;
}

.ai-errors-modal__list {
    overflow-y: auto;
    border-right: 1px solid #30363d;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ai-errors-modal__detail {
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 10px 12px;
}

.ai-errors-list__empty,
.ai-errors-detail__empty {
    color: #8b949e;
    font-size: 12px;
    padding: 16px 8px;
    text-align: center;
}

.ai-errors-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 8px 10px;
    border: 1px solid #30363d;
    border-radius: 8px;
    background: #21262d;
    color: #c9d1d9;
    cursor: pointer;
}

.ai-errors-item:focus-visible {
    outline: 1px solid #0e639c;
    outline-offset: 1px;
}

.ai-errors-item:hover {
    border-color: #484f58;
    background: #262c36;
}

.ai-errors-item.is-active {
    border-color: #0e639c;
    background: rgba(14, 99, 156, 0.15);
}

.ai-errors-item__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
}

.ai-errors-item__type {
    font-size: 10px;
    font-weight: 600;
    color: #f85149;
    text-transform: uppercase;
}

.ai-errors-item__time {
    font-size: 10px;
    color: #8b949e;
    flex-shrink: 0;
}

.ai-errors-item__msg {
    font-size: 12px;
    line-height: 1.45;
    color: #e6edf3;
    word-break: break-word;
}

.ai-errors-item__loc {
    margin-top: 4px;
    font-size: 10px;
    color: #8b949e;
    font-family: Consolas, monospace;
}

.ai-errors-detail__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    flex-shrink: 0;
}

.ai-errors-detail__type {
    font-size: 11px;
    font-weight: 600;
    color: #f85149;
}

.ai-errors-detail__loc {
    font-size: 11px;
    font-family: Consolas, monospace;
}

.ai-errors-detail__output {
    flex: 1;
    min-height: 280px;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    background: #0d1117;
    border: 1px solid #30363d;
}

.ai-errors-detail__msg {
    font-size: 12px;
    line-height: 1.55;
    color: #e6edf3;
    white-space: pre-wrap;
    word-break: break-word;
}

.ai-errors-detail__stack {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-family: Consolas, "Courier New", monospace;
    font-size: 11px;
    line-height: 1.5;
}

.ai-errors-stack-line {
    color: #c9d1d9;
    word-break: break-all;
}

.ai-errors-detail__stack-plain {
    margin: 0;
    font-family: Consolas, "Courier New", monospace;
    font-size: 11px;
    line-height: 1.55;
    color: #c9d1d9;
    white-space: pre-wrap;
    word-break: break-word;
}

.ai-errors-detail__foot {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-top: 8px;
    border-top: 1px solid #30363d;
    font-size: 11px;
    color: #8b949e;
}

.ai-errors-detail__foot-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px;
    word-break: break-all;
}

.ai-errors-detail__foot-label {
    color: #8b949e;
    flex-shrink: 0;
}

.ai-errors-stack-line .ai-src-link {
    color: #c9d1d9;
    text-decoration: none;
    cursor: pointer;
}

.ai-errors-stack-line .ai-src-link:hover {
    color: #e6edf3;
    text-decoration: none;
}

.ai-src-link {
    padding: 0;
    border: none;
    background: none;
    color: #79c0ff;
    font: inherit;
    font-family: Consolas, "Courier New", monospace;
    text-align: left;
    cursor: pointer;
    text-decoration: underline;
    text-decoration-color: rgba(121, 192, 255, 0.45);
    text-underline-offset: 2px;
}

.ai-src-link:hover {
    color: #a5d6ff;
    text-decoration-color: #a5d6ff;
}

.ai-errors-item__loc .ai-src-link {
    font-size: 10px;
}

.ai-errors-detail__loc .ai-src-link {
    font-size: 11px;
}

.ai-errors-detail__time {
    font-size: 11px;
    color: #8b949e;
}

.ai-errors-modal__foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 10px 14px 12px;
    border-top: 1px solid #30363d;
}

.ai-errors-modal__page-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    font-size: 12px;
    color: #8b949e;
    cursor: pointer;
    user-select: none;
}

.ai-errors-modal__page-badge input {
    margin: 0;
    cursor: pointer;
    accent-color: #0e639c;
}

.ai-errors-modal__page-badge:hover {
    color: #c9d1d9;
}

.ai-errors-modal__foot-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.ai-errors-modal__clear {
    padding: 6px 12px;
    border: 1px solid #3d444d;
    border-radius: 6px;
    background: transparent;
    color: #c9d1d9;
    font-size: 12px;
    cursor: pointer;
}

.ai-errors-modal__clear:hover:not(:disabled) {
    border-color: #6e7681;
    background: #21262d;
    color: #f0f6fc;
}

.ai-errors-modal__clear:disabled,
.ai-errors-modal__clear.is-disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.ai-errors-modal__analyze {
    padding: 6px 14px;
    border: none;
    border-radius: 6px;
    background: #0e639c;
    color: #fff;
    font-size: 12px;
    cursor: pointer;
}

.ai-errors-modal__analyze:hover:not(:disabled) {
    background: #1177bb;
}

.ai-errors-modal__analyze:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

@media (max-width: 520px) {
    .ai-errors-modal__body {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(120px, 36%) 1fr;
    }

    .ai-errors-modal__list {
        border-right: none;
        border-bottom: 1px solid #30363d;
    }
}
