/* ===== 基础 ===== */
.yuanma-tool {
    width: 100%;
    font-size: 14px;
    color: #e0e0e0;
}

.ym-header {
    margin-bottom: 16px;
}
.ym-url-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.ym-input {
    flex: 1;
    min-width: 200px;
    padding: 10px 14px;
    border: 1px solid #444;
    border-radius: 6px;
    background: #1e1e1e;
    color: #e0e0e0;
    font-size: 14px;
    outline: none;
}
.ym-input:focus {
    border-color: #4a9eff;
}
.ym-status {
    margin-top: 8px;
    font-size: 13px;
    color: #888;
    min-height: 20px;
}
.ym-status.loading { color: #f0ad4e; }
.ym-status.success { color: #5cb85c; }
.ym-status.error { color: #d9534f; }

/* ===== 按钮 ===== */
.ym-btn {
    padding: 8px 18px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all .2s;
    white-space: nowrap;
}
.ym-btn-primary {
    background: #4a9eff;
    color: #fff;
}
.ym-btn-primary:hover { background: #3a8aee; }
.ym-btn-secondary {
    background: #444;
    color: #e0e0e0;
}
.ym-btn-secondary:hover { background: #555; }
.ym-btn-small {
    padding: 4px 12px;
    font-size: 12px;
    background: #333;
    color: #ccc;
}
.ym-btn-small:hover { background: #444; }
.ym-btn-danger {
    background: #d9534f;
    color: #fff;
}
.ym-btn-danger:hover { background: #c9302c; }

/* ===== 提示栏 ===== */
.ym-tip-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    background: #2a1a1a;
    border-radius: 6px;
    margin-bottom: 10px;
    border-left: 3px solid #f0ad4e;
    color: #f0ad4e;
    font-size: 13px;
    flex-wrap: wrap;
}
.ym-tip-bar button { margin-left: auto; }

/* ===== Tab ===== */
.ym-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #333;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.ym-tab-btn {
    padding: 10px 24px;
    background: transparent;
    border: none;
    color: #888;
    cursor: pointer;
    font-size: 14px;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all .2s;
}
.ym-tab-btn:hover { color: #ccc; }
.ym-tab-btn.active {
    color: #4a9eff;
    border-bottom-color: #4a9eff;
}
.ym-panel {
    display: none;
    min-height: 400px;
}
.ym-panel.active { display: block; }

/* ===== 源码查看 ===== */
.ym-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid #2a2a2a;
    margin-bottom: 8px;
}
.ym-range {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.ym-range label {
    font-size: 12px;
    color: #888;
}
.ym-line-input {
    width: 50px;
    padding: 2px 6px;
    background: #1e1e1e;
    border: 1px solid #444;
    border-radius: 4px;
    color: #e0e0e0;
    font-size: 12px;
}

.ym-code-wrap {
    display: flex;
    background: #1e1e1e;
    border-radius: 6px;
    overflow: hidden;
    max-height: 600px;
    min-height: 300px;
    position: relative;
}
.ym-line-nums {
    min-width: 50px;
    padding: 12px 10px;
    background: #252525;
    color: #666;
    font-family: Consolas, Monaco, monospace;
    font-size: 13px;
    line-height: 1.6;
    text-align: right;
    user-select: none;
    overflow: hidden;
    border-right: 1px solid #333;
    flex-shrink: 0;
}
.ym-line-nums .ym-num-active { color: #4a9eff; }
.ym-code-pre {
    flex: 1;
    margin: 0;
    padding: 12px 16px;
    overflow: auto;
    font-family: Consolas, Monaco, monospace;
    font-size: 13px;
    line-height: 1.6;
    background: #1e1e1e;
}
.ym-code-pre code {
    display: block;
    white-space: pre;
    color: #d4d4d4;
}
.ym-code-pre code.ym-wrap {
    white-space: pre-wrap !important;
    word-break: break-all !important;
}

.ym-info-bar {
    display: flex;
    gap: 20px;
    padding: 6px 12px;
    font-size: 12px;
    color: #666;
    border-top: 1px solid #2a2a2a;
    margin-top: 6px;
}

/* ===== 源码还原 ===== */
.ym-restore-section {
    background: #1a1a1a;
    border-radius: 8px;
    margin-bottom: 16px;
    border: 1px solid #2a2a2a;
    overflow: hidden;
}
.ym-restore-primary { border-color: #4a9eff; }
.ym-restore-secondary { border-color: #333; }

.ym-restore-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: #222;
    border-bottom: 1px solid #2a2a2a;
    flex-wrap: wrap;
}
.ym-restore-badge {
    background: #4a9eff;
    color: #fff;
    font-size: 10px;
    padding: 1px 10px;
    border-radius: 10px;
    font-weight: bold;
}
.ym-restore-badge-secondary { background: #555; }
.ym-restore-title {
    font-size: 13px;
    color: #ccc;
}
.ym-restore-body {
    padding: 12px 16px;
}
.ym-restore-textarea {
    width: 100%;
    min-height: 120px;
    padding: 10px 12px;
    background: #0d0d0d;
    border: 1px solid #333;
    border-radius: 6px;
    color: #e0e0e0;
    font-size: 13px;
    font-family: Consolas, Monaco, monospace;
    resize: vertical;
    outline: none;
    box-sizing: border-box;
}
.ym-restore-textarea:focus { border-color: #4a9eff; }
.ym-restore-hint {
    font-size: 12px;
    color: #666;
    margin-left: 10px;
}
.ym-restore-result {
    padding: 0 16px 16px 16px;
    min-height: 40px;
}
.ym-restore-result .ym-restore-content {
    background: #0d0d0d;
    padding: 12px 14px;
    border-radius: 4px;
    font-size: 13px;
    line-height: 1.7;
    max-height: 300px;
    overflow: auto;
    color: #e0e0e0;
}
.ym-restore-result .ym-restore-content * {
    user-select: text !important;
    -webkit-user-select: text !important;
}
.ym-restore-result .ym-restore-success {
    color: #5cb85c;
    font-size: 13px;
    padding: 6px 0;
}
.ym-restore-result .ym-restore-error {
    color: #d9534f;
    font-size: 13px;
    padding: 6px 0;
}

.ym-restore-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px 0;
    border-top: 1px solid #2a2a2a;
    margin-top: 4px;
}

/* ===== AI ===== */
.ym-ai-bar {
    border-bottom: 1px solid #2a2a2a;
    padding-bottom: 12px;
    margin-bottom: 12px;
}
.ym-ai-presets {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}
.ym-ai-preset {
    background: #2a2a2a;
    color: #aaa;
}
.ym-ai-preset:hover {
    background: #3a3a3a;
    color: #fff;
}
.ym-ai-input-row {
    display: flex;
    gap: 10px;
}
.ym-ai-textarea {
    flex: 1;
    padding: 8px 12px;
    background: #1e1e1e;
    border: 1px solid #444;
    border-radius: 6px;
    color: #e0e0e0;
    font-size: 13px;
    resize: vertical;
    min-height: 40px;
    font-family: inherit;
}
.ym-ai-textarea:focus {
    border-color: #4a9eff;
    outline: none;
}
.ym-ai-result {
    background: #1e1e1e;
    border-radius: 6px;
    padding: 16px;
    min-height: 200px;
    max-height: 500px;
    overflow: auto;
    font-size: 14px;
    line-height: 1.8;
    color: #e0e0e0;
}
.ym-ai-placeholder {
    color: #666;
    text-align: center;
    padding: 60px 0;
}
.ym-ai-result .ym-ai-loading {
    color: #f0ad4e;
    animation: ymPulse 1.2s infinite;
}
@keyframes ymPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .4; }
}
.ym-ai-result pre {
    background: #252525;
    padding: 12px;
    border-radius: 4px;
    overflow: auto;
    font-size: 13px;
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .ym-url-row { flex-direction: column; }
    .ym-toolbar { flex-direction: column; align-items: stretch; }
    .ym-range { flex-wrap: wrap; }
    .ym-ai-presets { gap: 4px; }
    .ym-ai-preset { font-size: 11px; padding: 3px 10px; }
    .ym-line-nums { min-width: 36px; font-size: 11px; padding: 8px 6px; }
    .ym-code-pre { font-size: 11px; padding: 8px 10px; }
    .ym-tab-btn { padding: 8px 14px; font-size: 13px; }
    .ym-restore-header { flex-wrap: wrap; }
    .ym-restore-textarea { min-height: 80px; font-size: 12px; }
    .ym-tip-bar { font-size: 12px; }
}