.psi-tool-wrapper { --p-bg: #ffffff; --p-border: #e2e8f0; --p-primary: #3b82f6; --p-text: #0f172a; width: 100%; max-width: 1200px; margin: 0 auto; background: var(--p-bg); border-radius: 24px; padding: 32px; border: 1px solid var(--p-border); box-shadow: 0 10px 25px -5px rgba(0,0,0,0.05); transition: 0.3s; }
.psi-header-main { font-size: 1.6rem; font-weight: 700; color: var(--p-text); margin-bottom: 12px; display: flex; align-items: center; justify-content: center; gap: 12px; }
.psi-badge { background: #dbeafe; color: #1d4ed8; padding: 4px 12px; border-radius: 30px; font-size: 0.85rem; font-weight: 600; border: 1px solid #bfdbfe; }
.psi-subtitle { color: #64748b; font-size: 1rem; padding-bottom: 20px; border-bottom: 1px solid var(--p-border); margin-bottom: 24px; text-align: center; max-width: 900px; margin-left: auto; margin-right: auto; line-height: 1.6; }

.psi-layout { display: flex; flex-direction: column; gap: 24px; }

.psi-panel { background: #f8fafc; border: 1px solid var(--p-border); border-radius: 16px; padding: 24px; transition: 0.3s; display: flex; flex-direction: column; }
.psi-result-panel { min-height: 300px; background: #ffffff; }

.psi-panel-title { font-weight: 700; color: var(--p-text); font-size: 1.1rem; display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--p-border); }
.psi-btn-icon { background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 8px; color: #64748b; cursor: pointer; font-size: 1.1rem; padding: 6px 12px; transition: 0.2s; }
.psi-btn-icon:hover { color: var(--p-primary); background: #f8fafc; transform: translateY(-1px); }

/* 输入区排版 */
.psi-url-row { display: flex; gap: 16px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.psi-input { flex: 1; min-width: 250px; padding: 14px 16px; background: #ffffff; border: 2px solid #cbd5e1; color: var(--p-text); border-radius: 12px; outline: none; font-size: 1.05rem; transition: 0.2s; }
.psi-input:focus { border-color: var(--p-primary); box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1); }

/* API Key 排版 */
.psi-api-row { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.psi-input-sm { padding: 10px 14px; font-size: 0.9rem; border-radius: 10px; max-width: 400px; background: #f1f5f9; border-color: #e2e8f0; }
.psi-api-link { font-size: 0.9rem; color: var(--p-primary); text-decoration: none; font-weight: 600; white-space: nowrap; }
.psi-api-link:hover { text-decoration: underline; }

.psi-device-toggle { display: flex; gap: 8px; background: #e2e8f0; padding: 6px; border-radius: 12px; }
.psi-radio-label { padding: 8px 16px; border-radius: 8px; font-weight: 600; font-size: 0.95rem; color: #475569; cursor: pointer; transition: 0.2s; user-select: none; }
.psi-radio-label:has(input:checked) { background: #ffffff; color: var(--p-primary); box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
.psi-radio-label input { display: none; }

.psi-btn-primary { background: var(--p-primary); color: white; border: none; padding: 14px 28px; border-radius: 12px; font-weight: bold; font-size: 1.05rem; cursor: pointer; transition: 0.2s; box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3); white-space: nowrap; }
.psi-btn-primary:hover:not(:disabled) { filter: brightness(1.1); transform: translateY(-2px); }
.psi-btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.psi-loading-box { text-align: center; padding: 40px 0; background: #f8fafc; border-radius: 12px; border: 1px dashed #cbd5e1; margin-top: 20px; }
.psi-spinner { width: 42px; height: 42px; border: 4px solid rgba(59, 130, 246, 0.2); border-left-color: var(--p-primary); border-radius: 50%; animation: psiSpin 1s linear infinite; margin: 0 auto; }
@keyframes psiSpin { to { transform: rotate(360deg); } }
.psi-error-box { margin-top: 20px; padding: 16px; background: #fef2f2; border: 1px solid #fecaca; color: #dc2626; border-radius: 12px; font-size: 0.95rem; line-height: 1.6; }

.psi-empty-state { text-align: center; color: #94a3b8; font-size: 1rem; margin-top: 40px; margin-bottom: 40px; line-height: 1.6; }

/* 环形分数系统 (模拟 Lighthouse) */
.psi-scores-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 24px; margin-bottom: 30px; }
.psi-score-card { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.psi-score-name { font-weight: 700; color: var(--p-text); font-size: 1rem; text-align: center; }

.psi-circle { width: 100px; height: 100px; border-radius: 50%; display: flex; justify-content: center; align-items: center; font-size: 2.2rem; font-weight: 800; font-family: ui-monospace, monospace; border: 8px solid #e2e8f0; background: #ffffff; color: var(--p-text); box-shadow: 0 4px 10px rgba(0,0,0,0.05); }

/* Lighthouse 经典配色 */
.psi-color-green { border-color: #0cce6b; color: #0cce6b; }
.psi-color-orange { border-color: #ffa400; color: #ffa400; }
.psi-color-red { border-color: #ff4e42; color: #ff4e42; }

/* 核心指标表格 */
.psi-metrics-title { font-weight: 700; color: var(--p-text); font-size: 1.1rem; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--p-border); }
.psi-metrics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.psi-metric-item { background: #f8fafc; border: 1px solid #e2e8f0; padding: 16px; border-radius: 12px; display: flex; flex-direction: column; gap: 8px; }
.psi-metric-label { font-size: 0.85rem; font-weight: 700; color: #64748b; }
.psi-metric-val { font-size: 1.2rem; font-weight: 800; color: var(--p-text); font-family: monospace; }
.val-green { color: #0cce6b; }
.val-orange { color: #ffa400; }
.val-red { color: #ff4e42; }

/* 黑夜模式 */
[data-theme="dark"] .psi-tool-wrapper { background: #1e293b !important; border-color: #334155 !important; }
[data-theme="dark"] .psi-panel { background: #0f172a; border-color: #475569; }
[data-theme="dark"] .psi-result-panel { background: #1e293b; }
[data-theme="dark"] .psi-panel-title, [data-theme="dark"] .psi-metrics-title { border-bottom-color: #475569; }
[data-theme="dark"] .psi-input { background: #0f172a !important; border-color: #475569 !important; color: #f8fafc; }
[data-theme="dark"] .psi-input:focus { border-color: var(--p-primary); }
[data-theme="dark"] .psi-input-sm { background: #1e293b !important; border-color: #334155 !important; }
[data-theme="dark"] .psi-api-link { color: #60a5fa; }
[data-theme="dark"] .psi-device-toggle { background: #1e293b; }
[data-theme="dark"] .psi-radio-label { color: #94a3b8; }
[data-theme="dark"] .psi-radio-label:has(input:checked) { background: #334155; color: #60a5fa; }
[data-theme="dark"] .psi-metric-item { background: #0f172a; border-color: #334155; }
[data-theme="dark"] .psi-circle { background: #0f172a; }
[data-theme="dark"] .psi-score-name { color: #f8fafc; }
[data-theme="dark"] .psi-metric-label { color: #94a3b8; }
[data-theme="dark"] .psi-metric-val { color: #f8fafc; }