:root {
    /* 深色模式 (默认) */
    --bg: #050505;
    --surface: #121212;
    --border: #333;
    --text: #ffffff;
    --text-dim: #888;
    --accent: #fff;
    --success: #32d74b;
    --hover: #1f1f1f;
    --input-bg: #0a0a0a;
    --card-bg: rgba(18, 18, 18, 0.8);
}

[data-theme="light"] {
    /* 亮色模式 */
    --bg: #f5f5f7;
    --surface: #ffffff;
    --border: #e5e5e5;
    --text: #1d1d1f;
    --text-dim: #86868b;
    --accent: #007aff;
    --success: #34c759;
    --hover: #f2f2f7;
    --input-bg: #f5f5f7;
    --card-bg: rgba(255, 255, 255, 0.85);
}

* { box-sizing: border-box; outline: none; -webkit-tap-highlight-color: transparent; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: 'Inter', sans-serif; height: 100vh; overflow: hidden; transition: background 0.3s, color 0.3s; }

/* 修复浏览器自动填充背景 */
input:-webkit-autofill { -webkit-box-shadow: 0 0 0 30px var(--input-bg) inset !important; -webkit-text-fill-color: var(--text) !important; transition: background-color 5000s ease-in-out 0s; }

/* 顶部栏 */
.top-bar { position: absolute; top: 0; left: 0; width: 100%; height: 60px; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; z-index: 10; }
.logo { font-size: 20px; font-weight: 800; letter-spacing: -0.5px; }
.theme-btn { background: none; border: 1px solid var(--border); width: 36px; height: 36px; border-radius: 50%; color: var(--text); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: 0.2s; background: var(--card-bg); }
.theme-btn:hover { background: var(--hover); }

/* 布局 */
.view-container { position: absolute; inset: 0; display: flex; flex-direction: column; background: radial-gradient(circle at 50% 10%, rgba(255,255,255,0.05) 0%, transparent 60%); }
.center-xy { align-items: center; justify-content: center; }

/* 卡片 */
.glass-panel { background: var(--card-bg); backdrop-filter: blur(20px); border: 1px solid var(--border); box-shadow: 0 40px 80px rgba(0,0,0,0.1); }
.card { width: 480px; padding: 50px 40px; border-radius: 24px; position: relative; transition: 0.3s; }

.header-text { text-align: center; margin-bottom: 40px; }
.brand { font-size: 32px; font-weight: 800; letter-spacing: -1px; margin-bottom: 8px; }
.subtitle { color: var(--text-dim); font-size: 14px; font-weight: 500; }

/* 输入框 */
.input-group { position: relative; margin-bottom: 25px; }
.input-group input { 
    width: 100%; background: var(--input-bg); border: 1px solid var(--border); 
    padding: 0 15px; height: 50px; color: var(--text); font-size: 16px; 
    border-radius: 12px; transition: 0.3s; 
}
.input-group input:focus { border-color: var(--accent); }
.input-group input::placeholder { opacity: 0; }
.input-group label { 
    position: absolute; top: 15px; left: 15px; color: var(--text-dim); 
    pointer-events: none; transition: 0.3s; font-size: 14px; font-weight: 500; 
}
.input-group input:focus ~ label, .input-group input:not(:placeholder-shown) ~ label { 
    top: -12px; left: 10px; font-size: 12px; color: var(--accent); background: var(--bg); padding: 0 5px; 
}

/* 按钮 */
.btn-primary { 
    width: 100%; background: var(--text); color: var(--bg); border: none; 
    height: 50px; border-radius: 12px; font-weight: 700; font-size: 16px; 
    cursor: pointer; transition: 0.2s; margin-top: 10px;
}
.btn-primary:hover { transform: translateY(-2px); opacity: 0.9; }
.btn-primary:active { transform: translateY(0); opacity: 0.8; }

.btn-text { background: none; border: none; color: var(--text-dim); margin-top: 20px; font-size: 13px; cursor: pointer; text-decoration: underline; }
.btn-text:hover { color: var(--text); }

/* 结果页 */
.result-area { text-align: center; animation: fadeUp 0.4s ease; }
.result-label { color: var(--text-dim); font-size: 13px; margin-bottom: 10px; }
.result-box { 
    background: var(--input-bg); border: 1px solid var(--border); border-radius: 12px; 
    padding: 6px; display: flex; align-items: center; justify-content: space-between;
}
#short-url-display { 
    flex: 1; text-align: left; padding: 0 15px; font-family: 'JetBrains Mono', monospace; 
    font-size: 16px; color: var(--success); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.btn-copy { 
    background: var(--surface); border: 1px solid var(--border); color: var(--text); 
    padding: 10px 20px; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; 
}
.btn-copy:hover { border-color: var(--accent); }

.footer { position: absolute; bottom: 30px; color: var(--text-dim); font-size: 12px; font-family: monospace; }

/* 动画与工具 */
@keyframes fadeUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
#toast { position: fixed; bottom: 40px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 12px 30px; border-radius: 50px; font-weight: 700; z-index: 999; box-shadow: 0 10px 30px rgba(0,0,0,0.2); pointer-events: none; opacity: 0; transition: 0.3s; }

@media (max-width: 600px) {
    .card { width: 90%; padding: 40px 25px; }
    .brand { font-size: 28px; }
}