:root {
    --bg: #f0f2f5;
    --card-bg: #fff;
    --border: #d4d4d4;
    --text: #333;
    --text-secondary: #777;
    --text-muted: #999;
    --primary: #4a6d8c;
    --primary-hover: #3a5a73;
    --success: #27ae60;
    --warning: #e67e22;
    --info: #7f8c8d;
    --tab-active: #3b5c78;
    --tag-bg: #eef3f7;
    --tag-text: #4a6d8c;
    --dot-online: #27ae60;
    --dot-away: #e67e22;
    --dot-busy: #c0392b;
    --dot-offline: #95a5a6;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
    --font-mono: "SF Mono", "Menlo", "Consolas", "Courier New", monospace;
    --radius: 3px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    --transition: 0.15s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 24px 12px 40px;
    -webkit-font-smoothing: antialiased;
}

/* 嵌入模式：去除背景、边距，隐藏部分装饰元素 */
body.embed-mode {
    background: #fff;
    padding: 0;
    min-height: auto;
}

body.embed-mode .app-container {
    max-width: 100%;
    border: none;
    box-shadow: none;
    overflow-x: hidden;
}

body.embed-mode .header,
body.embed-mode .tab-nav,
body.embed-mode .status-bar,
body.embed-mode .embed-btn-wrapper,
body.embed-mode .panel .input-row {
    display: none !important;
}

/* 嵌入模式显示作者信息 */
body.embed-mode .embed-author {
    display: flex !important;
}

body.embed-mode .panel {
    border: none;
    box-shadow: none;
    border-radius: 0;
    padding: 0;
}

body.embed-mode .result-header .name {
    width: 340px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.embed-mode .result-header .info-main {
    overflow: hidden;
}

body.embed-mode .result-table .value {
    word-break: break-word;
}

.app-container {
    width: 100%;
    max-width: 680px;
    display: flex;
    flex-direction: column;
    gap: 0;
    position: relative;
}

.header {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 0;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.header .title {
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
    letter-spacing: 0.3px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.header .title .icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    color: #4a6d8c;
}

.header .title .icon svg {
    width: 100%;
    height: 100%;
}

.header .api-source {
    font-size: 12px;
    color: var(--text-muted);
    background: var(--tag-bg);
    padding: 3px 10px;
    border-radius: 2px;
    border: 1px solid #dce4ec;
    white-space: nowrap;
}

.tab-nav {
    display: flex;
    gap: 0;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 12px;
}

.tab-btn {
    flex: 1;
    padding: 11px 16px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
    letter-spacing: 0.2px;
    font-family: var(--font);
    border-right: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.tab-btn:last-child {
    border-right: none;
}

.tab-btn:hover {
    color: #2c3e50;
    background: #fafbfc;
}

.tab-btn.active {
    color: var(--tab-active);
    font-weight: 600;
    background: #f8fafb;
    box-shadow: inset 0 -3px 0 var(--tab-active);
}

.tab-btn .tab-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.tab-btn .tab-dot.qq-dot {
    background: #5b8cb8;
}

.tab-btn .tab-dot.group-dot {
    background: #6da87c;
}

.panel {
    display: none;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    flex-direction: column;
    gap: 16px;
}

.panel.active {
    display: flex;
}

.input-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.input-row input {
    flex: 1;
    min-width: 180px;
    padding: 9px 12px;
    font-size: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fafbfc;
    color: var(--text);
    font-family: var(--font);
    transition: border-color var(--transition);
    outline: none;
}

.input-row input:focus {
    border-color: #7fa3bd;
    background: #fff;
    box-shadow: 0 0 0 2px rgba(74, 109, 140, 0.08);
}

.input-row input::placeholder {
    color: #bbb;
}

.btn {
    padding: 9px 18px;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    font-family: var(--font);
    letter-spacing: 0.2px;
    transition: all var(--transition);
    white-space: nowrap;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
}

.btn-outline {
    background: #fff;
    color: var(--primary);
    border-color: #bcccd8;
}

.btn-outline:hover {
    background: #f5f8fa;
    border-color: #9ab0c2;
}

.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
    border-radius: 2px;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.btn-embed {
    padding: 6px 16px;
    font-size: 12px;
    background: #fff;
    color: var(--primary);
    border: 1px solid #bcccd8;
}

.btn-embed:hover {
    background: #f5f8fa;
    border-color: #9ab0c2;
}

.result-area {
    display: none;
    border: 1px solid #e0e5ea;
    border-radius: var(--radius);
    background: #fcfdfe;
    overflow: hidden;
}

.result-area.visible {
    display: block;
}

.result-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid #eef1f4;
    background: #f9fafb;
    flex-wrap: wrap;
}

.result-header .avatar {
    width: 52px;
    height: 52px;
    border-radius: 2px;
    border: 1px solid #ddd;
    object-fit: cover;
    flex-shrink: 0;
    background: #eee;
}

.result-header .avatar-placeholder {
    width: 52px;
    height: 52px;
    border-radius: 2px;
    border: 1px solid #ddd;
    flex-shrink: 0;
    background: #e8ecf0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #b0b8c0;
}

.result-header .avatar-placeholder svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    fill: none;
}

.result-header .info-main {
    flex: 1;
    min-width: 140px;
}

.result-header .info-main .name-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.result-header .info-main .name {
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
}

.result-header .info-main .uin {
    font-size: 12px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-dot.online {
    background: var(--dot-online);
}

.status-dot.away {
    background: var(--dot-away);
}

.status-dot.busy {
    background: var(--dot-busy);
}

.status-dot.offline {
    background: var(--dot-offline);
}

.status-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.result-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.result-table tr {
    border-bottom: 1px solid #f2f4f6;
}

.result-table tr:last-child {
    border-bottom: none;
}

.result-table td {
    padding: 10px 16px;
    vertical-align: top;
}

.result-table .label {
    color: var(--text-secondary);
    white-space: nowrap;
    width: 1%;
    font-weight: 500;
    font-size: 12px;
    letter-spacing: 0.3px;
    padding-right: 8px;
}

.result-table .value {
    color: var(--text);
    word-break: break-all;
    font-size: 13px;
}

.result-table .value.mono {
    font-family: var(--font-mono);
    font-size: 12px;
}

.tag {
    display: inline-block;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 2px;
    font-weight: 500;
    letter-spacing: 0.2px;
}

.tag-male {
    background: #e8f4fd;
    color: #3b7db8;
    border: 1px solid #cde4f5;
}

.tag-female {
    background: #fde8ef;
    color: #b84d6e;
    border: 1px solid #f5cde0;
}

.tag-unknown {
    background: #f0f0f0;
    color: #888;
    border: 1px solid #e0e0e0;
}

.tag-grade {
    background: #fef9e7;
    color: #8a7518;
    border: 1px solid #f5e6b8;
}

.tag-muted {
    background: #f5f5f5;
    color: #888;
    border: 1px solid #e8e8e8;
}

.tag-danger {
    background: #fdedec;
    color: #a93226;
    border: 1px solid #f5c6cb;
}

.signature-text {
    color: #555;
    font-style: italic;
    font-size: 12px;
    line-height: 1.5;
}

.status-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 16px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 12px;
    color: var(--text-secondary);
    box-shadow: var(--shadow);
    flex-wrap: wrap;
    justify-content: space-between;
}

.status-bar .countdown {
    font-weight: 600;
    font-family: var(--font-mono);
    font-size: 13px;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-bar .countdown.warning {
    color: #c0392b;
    animation: pulse-warn 2s ease-in-out infinite;
}

@keyframes pulse-warn {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.status-bar .last-update {
    color: var(--text-muted);
}

.status-bar .auto-tag {
    font-size: 10px;
    background: #e8f5e9;
    color: #2e7d32;
    padding: 2px 8px;
    border-radius: 2px;
    border: 1px solid #c8e6c9;
    font-weight: 500;
    letter-spacing: 0.3px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.status-bar .auto-tag.paused {
    background: #fff3e0;
    color: #e67e22;
    border-color: #ffe0b2;
}

.status-bar .auto-tag svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.loading-inline {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid #ddd;
    border-top-color: #5b7d99;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    vertical-align: middle;
    margin-right: 6px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Toast */
.toast {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 999;
    padding: 10px 20px;
    font-size: 13px;
    border-radius: var(--radius);
    border: 1px solid;
    font-weight: 500;
    letter-spacing: 0.2px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    opacity: 0;
    transition: opacity 0.25s ease, top 0.25s ease;
    pointer-events: none;
    font-family: var(--font);
}

.toast.show {
    opacity: 1;
    top: 24px;
}

.toast-error {
    background: #fdf0ef;
    color: #a93226;
    border-color: #f5c6cb;
}

.toast-success {
    background: #eef8f2;
    color: #1e7e34;
    border-color: #c3e6cb;
}

.toast-info {
    background: #eaf4fb;
    color: #3b6d8c;
    border-color: #c5ddf2;
}

/* 模态框（嵌入代码） */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.show {
    display: flex;
}

.modal-content {
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    padding: 24px;
    width: 90%;
    max-width: 560px;
    font-size: 14px;
}

.modal-content h3 {
    margin-bottom: 12px;
    font-size: 16px;
    font-weight: 600;
}

.modal-content p {
    margin-bottom: 8px;
    color: #555;
}

.modal-content textarea {
    width: 100%;
    height: 80px;
    font-family: var(--font-mono);
    font-size: 12px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 2px;
    resize: vertical;
    background: #fafbfc;
}

.modal-buttons {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    justify-content: flex-end;
}

/* 骨架屏样式 */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 3px;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.skeleton-avatar {
    width: 52px;
    height: 52px;
    border-radius: 2px;
    flex-shrink: 0;
}

.skeleton-line {
    height: 14px;
    margin-bottom: 10px;
}

.skeleton-line.short {
    width: 40%;
}

.skeleton-line.medium {
    width: 65%;
}

.skeleton-line.wide {
    width: 85%;
}

/* 嵌入模式作者信息 */
.embed-author {
    display: none;
    /* 默认隐藏 */
    text-align: center;
    padding: 8px 0;
    margin-top: 4px;
    font-size: 11px;
}

.embed-author a {
    color: #95a5a6;
    text-decoration: none;
    transition: color 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.embed-author a:hover {
    color: #7f8c8d;
}

.embed-author a::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 4px;
    background: #bdc3c7;
    border-radius: 50%;
    margin-right: 4px;
}

.embed-author a::after {
    content: '';
    display: inline-block;
    width: 4px;
    height: 4px;
    background: #bdc3c7;
    border-radius: 50%;
    margin-left: 4px;
}

@media (max-width: 500px) {
    .header {
        padding: 12px 14px;
    }

    .header .title {
        font-size: 16px;
    }

    .panel {
        padding: 14px;
    }

    .result-header {
        padding: 10px 12px;
        gap: 8px;
    }

    .result-header .avatar,
    .result-header .avatar-placeholder,
    .skeleton-avatar {
        width: 40px;
        height: 40px;
    }

    .result-table td {
        padding: 8px 10px;
        font-size: 12px;
    }

    .input-row input {
        min-width: 130px;
        font-size: 13px;
    }

    .btn {
        padding: 8px 14px;
        font-size: 13px;
    }

    .status-bar {
        gap: 8px;
        font-size: 11px;
        padding: 8px 12px;
    }
}