:root {
    --bg-html: #f5f7fa; 
    --bg-body-grad: linear-gradient(180deg, #f5f7fa 0%, #c3cfe2 100%);
    --bg-card: #ffffff;
    --bg-secondary: #f1f5f9;
    --text-main: #2d3748;
    --text-sub: #718096;
    --border-color: #e2e8f0;
    --shadow-card: 0 4px 15px rgba(0,0,0,0.05);
    --shadow-hover: 0 10px 25px rgba(0,0,0,0.1);
    --btn-grad: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --btn-danger: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    --btn-success: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --btn-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    --primary: #6366f1;
    --danger: #e53e3e;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body { 
    margin: 0; padding: 0; min-height: 100vh; 
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; 
    background: var(--bg-body-grad); 
    background-attachment: fixed;
    color: var(--text-main); 
    display: flex; flex-direction: column; align-items: center; 
}

.container { width: 100%; max-width: 500px; padding: 20px 16px; margin: 0 auto; display: flex; flex-direction: column; min-height: 100vh; }

/* 标题样式 */
h1 {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-main);
    text-align: center;
    margin: 30px 0 20px 0;
    text-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* 卡片通用样式 */
.card-box {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 24px;
    box-shadow: var(--shadow-card);
    border: 1px solid rgba(0,0,0,0.02);
    margin-bottom: 20px;
    transition: transform 0.2s;
}

/* 表单样式 */
.form-group { margin-bottom: 15px; }
input[type="email"], input[type="password"], input[type="text"] {
    width: 100%;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-main);
    font-size: 15px;
    outline: none;
    transition: 0.2s;
}
input:focus {
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* 按钮样式 */
button, .btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    color: white;
    background: var(--btn-grad);
    box-shadow: var(--btn-shadow);
    cursor: pointer;
    transition: transform 0.1s, opacity 0.2s;
    text-align: center;
}
button:active { transform: translateY(1px); }
button:hover { opacity: 0.95; }

button.secondary {
    background: var(--bg-secondary);
    color: var(--primary);
    box-shadow: none;
    border: 1px solid var(--primary);
}
button.danger { background: var(--btn-danger); box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3); }
button.success { background: var(--btn-success); box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3); }

/* 错误与提示 */
.error-msg {
    background: #fef2f2;
    color: var(--danger);
    padding: 12px;
    border-radius: 10px;
    font-size: 13px;
    text-align: center;
    margin-bottom: 15px;
    border: 1px solid #fee2e2;
}
.tip-text {
    font-size: 12px;
    color: var(--text-sub);
    text-align: center;
    margin-top: 15px;
    line-height: 1.5;
}

/* SIM 卡列表样式 */
.sim-item {
    padding-bottom: 20px;
    margin-bottom: 20px;
    border-bottom: 1px dashed var(--border-color);
}
.sim-item:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

.sim-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.sim-number { font-size: 18px; font-weight: 700; color: var(--text-main); }
.sim-status { 
    font-size: 12px; 
    padding: 4px 8px; 
    border-radius: 6px; 
    background: var(--bg-secondary);
    color: var(--text-sub);
    font-weight: 600;
}
.sim-status.active { background: #d1fae5; color: #059669; }

/* 详情页样式 */
.esim-detail {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 15px;
    margin-top: 15px;
    animation: slideDown 0.3s ease-out;
}
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

.detail-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}
.detail-row:last-of-type { border-bottom: none; }
.detail-label { color: var(--text-sub); }
.detail-val { font-weight: 600; color: var(--text-main); word-break: break-all; text-align: right; margin-left: 10px;}

/* 二维码区域 */
.qrcode-box {
    background: white;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    margin: 15px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.qrcode-text {
    margin-top: 10px;
    font-family: monospace;
    font-size: 11px;
    color: var(--text-sub);
    word-break: break-all;
    background: var(--bg-secondary);
    padding: 8px;
    border-radius: 6px;
}

/* Loading 遮罩 */
.loading-overlay {
    position: absolute; inset: 0;
    background: rgba(255,255,255,0.8);
    backdrop-filter: blur(2px);
    display: flex; align-items: center; justify-content: center;
    border-radius: 12px;
    z-index: 10;
}
.spinner {
    width: 30px; height: 30px;
    border: 3px solid rgba(99, 102, 241, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s infinite linear;
}
@keyframes spin { to { transform: rotate(360deg); } }
.hidden { display: none !important; }

/* --- 底部声明与 TG 按钮样式 --- */
.footer-note-main {
    text-align: center;
    font-size: 11px;
    color: var(--text-sub);
    margin-top: auto; /* 自动推到最底部 */
    padding: 20px 0 40px 0;
    line-height: 1.6;
    opacity: 0.9;
}

.footer-note-main span { 
    opacity: 0.7; 
}

.tg-link-main {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 12px;
    color: var(--text-sub);
    background: var(--bg-secondary);
    width: 42px; 
    height: 42px;
    border-radius: 50%;
    transition: all 0.2s ease;
    text-decoration: none;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.tg-link-main:hover { 
    background: #e0f2fe; 
    color: #229ED9; /* Telegram Blue */
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(34, 158, 217, 0.2);
}

.tg-link-main svg { 
    width: 20px; 
    height: 20px; 
    fill: currentColor; 
}