/* ===============================
   全局基础样式
   =============================== */
:root {
    --color-primary: #4f46e5;
    --color-primary-dark: #4338ca;
    --color-primary-soft: rgba(79, 70, 229, 0.12);
    --color-text-main: #0f172a;
    --color-text-muted: #475569;
    --color-border: #e2e8f0;
    --color-panel: #ffffff;
    --color-surface: rgba(255, 255, 255, 0.85);
    --color-success: #16a34a;
    --color-success-bg: #dcfce7;
    --color-error: #dc2626;
    --color-error-bg: #fee2e2;
    --color-warning: #eab308;
    --color-warning-bg: #fef9c3;
    --color-info: #0ea5e9;
    --color-info-bg: #e0f2fe;
    --shadow-sm: 0 6px 16px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 25px 60px rgba(15, 23, 42, 0.12);
    --radius-lg: 26px;
    --radius-md: 18px;
    --radius-sm: 10px;
    font-size: 16px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "HarmonyOS Sans", "Tencent Sans", "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
    color: var(--color-text-main);
    background:
        radial-gradient(800px 600px at 15% 10%, rgba(255, 228, 196, 0.6), transparent 60%),
        radial-gradient(900px 700px at 85% 0%, rgba(196, 221, 255, 0.55), transparent 62%),
        radial-gradient(1000px 800px at 50% 100%, rgba(205, 255, 231, 0.5), transparent 60%),
        linear-gradient(180deg, #f5f7ff 0%, #ffffff 60%, #f8fafc 100%);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

main {
    width: 100%;
}

/* ===============================
   顶部导航
   =============================== */
.navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 18px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--color-text-main);
}

.brand-icon {
    font-size: 1.5rem;
}

.nav-toggle {
    display: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    background: rgba(79, 70, 229, 0.08);
    color: var(--color-primary);
}

.nav-menu {
    list-style: none;
    display: flex;
    gap: 24px;
    padding: 0;
    margin: 0;
}

.nav-menu a {
    color: var(--color-text-muted);
    font-weight: 500;
    transition: color 0.2s ease, transform 0.2s ease;
}

.nav-menu a:hover,
.nav-menu a:focus-visible {
    color: var(--color-primary);
    transform: translateY(-1px);
}

/* ===============================
   头部介绍
   =============================== */
.hero {
    max-width: 760px;
    margin: 70px auto 48px;
    text-align: center;
    padding: 0 24px;
}

.hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    border-radius: 999px;
    background: rgba(79, 70, 229, 0.12);
    color: var(--color-primary);
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-size: 0.8rem;
}

.hero h1 {
    margin: 20px 0 16px;
    font-size: clamp(2.3rem, 5vw, 3rem);
    font-weight: 800;
}

.hero-lead {
    color: var(--color-text-muted);
    font-size: 1.05rem;
    margin: 0 auto;
}

/* ===============================
   标签与面板
   =============================== */
.tabs {
    max-width: 960px;
    margin: 0 auto 32px;
    padding: 0 24px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
}

.tab-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 24px;
    border-radius: var(--radius-md);
    background: var(--color-surface);
    border: 1px solid rgba(255, 255, 255, 0.36);
    box-shadow: var(--shadow-sm);
    color: var(--color-text-muted);
    transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
    text-align: left;
}

.tab-card .tab-icon {
    font-size: 1.6rem;
}

.tab-card .tab-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--color-text-main);
}

.tab-card.active,
.tab-card:hover {
    transform: translateY(-4px);
    background: #ffffff;
    box-shadow: var(--shadow-md);
}

.tab-card.active {
    border: 1px solid rgba(79, 70, 229, 0.32);
}

.content {
    max-width: 960px;
    margin: 0 auto 80px;
    padding: 0 24px 48px;
}

.panel {
    display: none;
    background: #ffffff;
    border-radius: var(--radius-lg);
    padding: 36px 40px;
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(148, 163, 184, 0.18);
}

.panel.active {
    display: block;
}

.panel h2 {
    margin: 0 0 12px;
    font-size: 1.8rem;
    font-weight: 700;
}

.panel-subtitle {
    margin: 0 0 24px;
    color: var(--color-text-muted);
    font-size: 1rem;
}

/* ===============================
   表单与按钮
   =============================== */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.form-grid.single {
    grid-template-columns: 1fr;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.form-group label {
    font-weight: 600;
    color: var(--color-text-main);
}

.form-group input,
.form-group select {
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background: rgba(248, 250, 252, 0.7);
}

.form-group input:focus-visible,
.form-group select:focus-visible {
    outline: none;
    border-color: rgba(79, 70, 229, 0.65);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
    background: #ffffff;
}

.form-group input:disabled,
.form-group select:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    background: rgba(226, 232, 240, 0.5);
}

.form-group input.readonly {
    background: rgba(226, 232, 240, 0.5);
    color: var(--color-text-muted);
    cursor: pointer;
}

.form-group input.readonly:focus-visible {
    border-color: rgba(79, 70, 229, 0.45);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.12);
}

.field-tip {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    font-size: 0.95rem;
    color: var(--color-text-muted);
}

.primary-btn {
    width: 100%;
    margin-top: 24px;
    padding: 16px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, #5b4cf0, #4338ca);
    color: #ffffff;
    font-weight: 700;
    font-size: 1rem;
    box-shadow: 0 16px 40px rgba(79, 70, 229, 0.2);
    transition: transform 0.2s ease, box-shadow 0.25s ease;
}

.primary-btn:disabled {
    background: rgba(148, 163, 184, 0.5);
    box-shadow: none;
    cursor: not-allowed;
}

.primary-btn:not(:disabled):hover {
    transform: translateY(-1px);
    box-shadow: 0 22px 48px rgba(79, 70, 229, 0.28);
}

.ghost-btn {
    padding: 10px 18px;
    border-radius: 999px;
    background: rgba(79, 70, 229, 0.1);
    color: var(--color-primary);
    font-weight: 600;
    transition: background 0.2s ease, transform 0.2s ease;
}

.ghost-btn:hover {
    background: rgba(79, 70, 229, 0.18);
    transform: translateY(-1px);
}

/* ===============================
   免责声明与结果
   =============================== */
.disclaimer {
    background: rgba(79, 70, 229, 0.05);
    border-radius: var(--radius-sm);
    border: 1px dashed rgba(79, 70, 229, 0.2);
    padding: 20px;
    margin-top: 10px;
    margin-bottom: 24px;
}

.results {
    margin-top: 28px;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    background: rgba(248, 250, 252, 0.6);
    padding: 24px;
}

.results-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.results-header h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.results-list {
    display: grid;
    gap: 12px;
}

.result-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    background: #ffffff;
    border: 1px solid rgba(226, 232, 240, 0.8);
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.06);
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.result-item strong {
    font-family: "JetBrains Mono", "Fira Code", "Cascadia Mono", monospace;
    font-size: 1rem;
    letter-spacing: 0.06em;
}

.copy-btn {
    padding: 6px 12px;
    border-radius: 8px;
    background: rgba(79, 70, 229, 0.12);
    color: var(--color-primary);
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.copy-btn:hover {
    background: rgba(79, 70, 229, 0.18);
}

.result-item.copied {
    background: rgba(22, 163, 74, 0.12);
    border-color: rgba(22, 163, 74, 0.35);
    box-shadow: 0 12px 28px rgba(22, 163, 74, 0.18);
}

.result-item.copied strong {
    color: var(--color-success);
}

.copy-btn.copied {
    background: var(--color-success);
    color: #ffffff;
}

.copy-btn.copied:hover {
    background: var(--color-success);
}

.loading {
    margin-top: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    background: rgba(15, 23, 42, 0.08);
    color: var(--color-text-main);
    font-weight: 600;
}

.loading[hidden] {
    display: none;
}

.spinner {
    width: 22px;
    height: 22px;
    border: 3px solid rgba(15, 23, 42, 0.12);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===============================
   查询结果
   =============================== */
.query-result {
    margin-top: 24px;
    border-radius: var(--radius-md);
    padding: 20px 24px;
    border: 1px solid rgba(226, 232, 240, 0.9);
    background: #ffffff;
    box-shadow: var(--shadow-sm);
}

.query-result.success {
    border-color: rgba(22, 163, 74, 0.35);
    background: rgba(220, 252, 231, 0.6);
}

.query-result.invalid {
    border-color: rgba(220, 38, 38, 0.35);
    background: rgba(254, 226, 226, 0.6);
}

.query-result h3 {
    margin-top: 0;
    margin-bottom: 12px;
    font-size: 1.35rem;
}

.query-result p {
    margin: 6px 0;
    color: var(--color-text-muted);
}

.query-result strong {
    margin-right: 6px;
    color: var(--color-text-main);
}

.query-result code {
    font-family: "JetBrains Mono", monospace;
    padding: 2px 6px;
    border-radius: 6px;
    background: rgba(15, 23, 42, 0.08);
}

.valid-text {
    color: var(--color-success);
    font-weight: 700;
}

.invalid-text {
    color: var(--color-error);
    font-weight: 700;
}

.unknown-text {
    color: #c2410c;
    font-weight: 700;
}

.doc-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 16px;
    color: var(--color-primary);
    font-weight: 600;
}

.doc-link::after {
    content: "↗";
    font-size: 0.9rem;
}

.query-actions {
    margin-top: 18px;
}

.external-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    border-radius: 999px;
    background: rgba(79, 70, 229, 0.12);
    color: var(--color-primary);
    font-weight: 600;
    transition: background 0.2s ease, transform 0.2s ease;
}

.external-link:hover {
    background: rgba(79, 70, 229, 0.18);
    transform: translateY(-1px);
}

/* ===============================
   设备列表
   =============================== */
.device-section {
    margin-top: 32px;
}

.device-section header {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.device-groups {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.device-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.device-group-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--color-text-main);
}

.device-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.device-card {
    padding: 16px 18px;
    border-radius: var(--radius-sm);
    background: rgba(248, 250, 252, 0.8);
    border: 1px solid rgba(226, 232, 240, 0.7);
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    cursor: pointer;
}

.device-card:hover {
    transform: translateY(-3px);
    border-color: rgba(79, 70, 229, 0.35);
    box-shadow: 0 18px 36px rgba(79, 70, 229, 0.18);
}

.device-card-static {
    cursor: default;
}

.device-card-static:hover {
    transform: none;
    border-color: rgba(226, 232, 240, 0.7);
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.08);
}

.device-card h4 {
    margin: 0 0 6px;
    font-size: 1rem;
}

.device-card span {
    display: inline-block;
    font-family: "JetBrains Mono", monospace;
    font-size: 0.95rem;
    padding: 4px 8px;
    border-radius: 6px;
    background: rgba(15, 23, 42, 0.08);
    color: var(--color-text-main);
}

/* ===============================
   底部
   =============================== */
.footer {
    margin-top: 40px;
    padding: 60px 24px;
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.14), rgba(14, 165, 233, 0.12));
}

.footer-inner {
    max-width: 920px;
    margin: 0 auto;
    color: var(--color-text-main);
    text-align: center;
}

.footer-inner h2 {
    margin-top: 0;
    font-size: 1.4rem;
}

.footer-inner p {
    margin: 8px 0;
    color: var(--color-text-muted);
}

/* ===============================
   Toast通知系统
   =============================== */
.toast-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: min(420px, 92vw);
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-radius: var(--radius-sm);
    background: #ffffff;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
    transform: translateY(-18px);
    opacity: 0;
    animation: toast-in 0.32s ease forwards;
    pointer-events: auto;
}

.toast-success {
    border-left: 6px solid var(--color-success);
    background: var(--color-success-bg);
}

.toast-error {
    border-left: 6px solid var(--color-error);
    background: var(--color-error-bg);
}

.toast-warning {
    border-left: 6px solid var(--color-warning);
    background: var(--color-warning-bg);
}

.toast-info {
    border-left: 6px solid var(--color-info);
    background: var(--color-info-bg);
}

.toast-icon {
    font-size: 1.3rem;
}

.toast-message {
    flex: 1;
    font-weight: 600;
    color: var(--color-text-main);
}

.toast-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    line-height: 1;
    color: rgba(15, 23, 42, 0.6);
    cursor: pointer;
}

.toast.removing {
    animation: toast-out 0.25s ease forwards;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(-36px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes toast-out {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-28px);
    }
}

/* ===============================
   响应式细节
   =============================== */
@media (max-width: 760px) {
    .nav-menu {
        position: absolute;
        inset: 70px 16px auto;
        padding: 18px;
        flex-direction: column;
        background: rgba(255, 255, 255, 0.96);
        border-radius: var(--radius-sm);
        border: 1px solid rgba(148, 163, 184, 0.2);
        box-shadow: var(--shadow-md);
        display: none;
    }

    .nav-menu.open {
        display: flex;
    }

    .nav-toggle {
        display: inline-flex;
    }

    .panel {
        padding: 28px 22px;
    }

    .results {
        padding: 20px;
    }
}

@media (max-width: 540px) {
    .hero {
        margin-top: 52px;
        padding: 0 18px;
    }

    .tabs {
        grid-template-columns: 1fr;
    }

    .results-header {
        flex-direction: column;
        align-items: flex-start;
    }
}
