:root {
    --bg-color: #ffffff;
    --text-color: #000000;
    --accent-color: #f7f7f7;
    --border-color: #e0e0e0;
    --secondary-text: #666666;
    --danger-color: #ff3b30;
    --primary-color: #000000;
    --success-color: #34c759;
    --card-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] {
    --bg-color: #0c0c0c;
    --text-color: #e0e0e0;
    --accent-color: #1a1a1a;
    --border-color: #2a2a2a;
    --secondary-text: #888888;
    --danger-color: #ff453a;
    --primary-color: #ffffff;
}

/* 全局美化滚动条 */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-text);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

header {
    height: 60px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-color);
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.logo {
    font-weight: 600;
    font-size: 1.1rem;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-card {
    background: var(--bg-color);
    padding: 24px;
    border-radius: 20px;
    width: 90%;
    max-width: 400px;
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--secondary-text);
    cursor: pointer;
    line-height: 1;
}

.tab-buttons {
    display: flex;
    background: var(--accent-color);
    padding: 4px;
    border-radius: 12px;
    margin-bottom: 16px;
}

.tab-btn {
    flex: 1;
    border: none;
    background: none;
    padding: 10px;
    border-radius: 10px;
    color: var(--secondary-text);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.tab-btn.active {
    background: var(--bg-color);
    color: var(--text-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ========== 账号区域 ========== */
.accounts-section {
    padding: 30px 0;
}

.accounts-section .section-header {
    margin-bottom: 20px;
}

.stats-summary {
    display: flex;
    gap: 16px;
}

.stat-item {
    font-size: 0.85rem;
    color: var(--secondary-text);
    display: flex;
    align-items: center;
    gap: 6px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.primary-btn.small {
    padding: 8px 16px;
    font-size: 0.85rem;
}

.accounts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

/* ========== 账号卡片 ========== */
.account-card {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 18px;
    transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.account-card:hover {
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
    border-color: var(--text-color);
}

.account-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.acc-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    flex-shrink: 0;
    object-fit: cover;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: 1.5px solid var(--border-color);
}

.acc-avatar-fallback {
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.3rem;
    color: white;
    flex-shrink: 0;
}

.acc-meta {
    flex: 1;
    min-width: 0;
}

.acc-meta h4 {
    font-weight: 600;
    font-size: 1.05rem;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.acc-meta .uin {
    font-size: 0.8rem;
    color: var(--secondary-text);
    display: flex;
    align-items: center;
    gap: 4px;
}

.acc-status-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.acc-status-badge.online {
    background: rgba(52, 199, 89, 0.1);
    color: #34c759;
}

.acc-status-badge.offline {
    background: var(--accent-color);
    color: var(--secondary-text);
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* 账号卡片内部信息行 */
.acc-info-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-top: 1px solid var(--border-color);
}

.info-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    font-weight: 500;
}

.info-item.gold .value {
    color: #f5a623;
}

/* 等级进度行 */
.level-progress-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.level-text {
    font-size: 0.9rem;
    font-weight: 600;
}

.progress-container {
    height: 8px;
    background: var(--accent-color);
    border-radius: 4px;
    flex: 1;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.progress-bar {
    height: 100%;
    background: #34c759;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.exp-text {
    font-size: 0.75rem;
    color: var(--secondary-text);
    min-width: 60px;
    text-align: right;
}

/* 运行统计行 - 网格布局 */
.acc-stats-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px 16px;
    padding: 10px 14px;
    background: var(--accent-color);
    border-radius: 8px;
    margin-bottom: 16px;
}

.stat-item-inner {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--secondary-text);
    padding: 2px 0;
}

.stat-item-inner b {
    color: var(--text-color);
    font-weight: 600;
}

/* .stat-item-inner b colors removed as requested */



/* 操作按钮 */
.acc-actions {
    display: flex;
    gap: 8px;
}

.acc-actions button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 38px;
    font-size: 0.85rem;
}

/* 按钮样式 */
.primary-btn {
    background: var(--text-color);
    color: var(--bg-color);
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.primary-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.secondary-btn {
    background: var(--accent-color);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 10px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.danger-btn {
    background: none;
    border: 1px solid var(--danger-color);
    color: var(--danger-color);
    padding: 10px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.danger-btn:hover {
    background: var(--danger-color);
    color: white;
}

.icon-btn {
    background: var(--accent-color);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.icon-btn:hover {
    background: var(--text-color);
    color: var(--bg-color);
}

.sun-icon,
.moon-icon {
    display: none;
}

[data-theme="light"] .sun-icon {
    display: block;
}

[data-theme="dark"] .moon-icon {
    display: block;
}

/* ========== 表单元素 ========== */
input[type="text"],
input[type="password"] {
    width: 100%;
    padding: 12px 16px;
    background: var(--accent-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-color);
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.2s;
}

input:focus {
    outline: none;
    border-color: var(--text-color);
    background: var(--bg-color);
}

.styled-select {
    width: 100%;
    padding: 12px 16px;
    background: var(--accent-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-color);
    font-size: 0.95rem;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
}

/* ========== 设置弹窗样式 ========== */
.setting-group {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.group-title {
    display: block;
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 12px;
    color: var(--text-color);
}

.switch-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px 20px;
}

.switch-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.switch-item span {
    font-size: 0.85rem;
    color: var(--secondary-text);
}

.modal-card.small {
    max-width: 400px;
}

#qr-content,
#manual-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 10px 0;
}

#qr-content button,
#manual-content button,
#manual-content input {
    max-width: 280px;
    width: 100%;
}

.tab-buttons {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

.switch {
    position: relative;
    width: 48px;
    height: 26px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-color);
    transition: .4s;
    border-radius: 34px;
    border: 1px solid var(--border-color);
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
}

input:checked+.slider {
    background-color: #34c759;
    border-color: #34c759;
}

input:checked+.slider:before {
    transform: translateX(22px);
}

/* Toast Notification */
.toast-container {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
    align-items: center;
    /* Center toasts horizontally */
}

.toast {
    background: rgba(30, 30, 30, 0.95);
    color: #fff;
    padding: 12px 24px;
    border-radius: 50px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    /* Center text inside */
    gap: 12px;
    animation: toastIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    min-width: 200px;
    /* Prevent being too narrow */
    max-width: 90vw;
    width: fit-content;
    /* Allow growing */
    pointer-events: auto;
    font-size: 0.95rem;
    backdrop-filter: blur(10px);
    text-align: center;
}

.toast.success {
    background: var(--success-color);
    color: white;
}

.toast.error {
    background: var(--danger-color);
    color: white;
}

.toast.info {
    border-left: 4px solid var(--primary-color);
}

@keyframes toastIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Manual Content Spacing */
#manual-content input {
    margin: 16px 0;
}

.hint {
    font-size: 0.85rem;
    color: var(--secondary-text);
}

/* ========== 二维码相关 ========== */
.qr-container {
    width: 200px;
    height: 200px;
    margin: 16px auto;
    background: var(--accent-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.qr-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.qr-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: var(--secondary-text);
    font-size: 0.9rem;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-color);
    border-top-color: var(--text-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.status-text {
    text-align: center;
    font-size: 0.95rem;
    font-weight: 500;
    margin-bottom: 16px;
}

.error-text {
    color: var(--danger-color);
    font-size: 0.85rem;
    text-align: center;
    margin-top: 12px;
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 0;
    color: var(--secondary-text);
}

.empty-icon {
    margin-bottom: 20px;
}

/* SVG Icon Helper */
.svg-icon {
    width: 1.1em;
    height: 1.1em;
    vertical-align: -0.2em;
    stroke: currentColor;
    stroke-width: 2.2;
    fill: none;
    transition: all 0.2s;
}

.acc-logs-panel {
    margin-top: 16px;
    border-radius: 10px;
    overflow: hidden;
    background: #000;
    border: 1px solid #333;
}

.acc-logs-header {
    padding: 8px 12px;
    background: #1a1a1a;
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #888;
    font-size: 0.75rem;
}

.acc-logs-header .clear-btn {
    background: #333;
    border: none;
    color: #ccc;
    padding: 2px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.7rem;
}

.acc-logs-container {
    height: 120px;
    padding: 10px;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.75rem;
    overflow-y: auto;
    color: #00ff41;
}

.acc-logs-container::-webkit-scrollbar {
    width: 5px;
}

.acc-logs-container::-webkit-scrollbar-track {
    background: #000;
}

.acc-logs-container::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 10px;
}

.acc-logs-container::-webkit-scrollbar-thumb:hover {
    background: #444;
}

.acc-log-entry {
    margin-bottom: 4px;
    line-height: 1.4;
    word-break: break-all;
}

.acc-log-entry .time {
    color: #888;
    margin-right: 6px;
}

.hidden {
    display: none !important;
}